Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Front End Technology Articles - Page 589 of 860
5K+ Views
Given an array, and generate the random permutation of array elements. It is similar like shuffling a deck of cards or randomize an array and every outcome after shuffling of array elements should likely and equally. Input output scenarios Consider an array having some elements present in it and assume we have performed fisher yates shuffle on that array. The output array will be randomly shuffled and shuffles for every time we execute. All the permutations are equally and likely. Input = [2, 4, 6, 8, 10] Output = 4, 10, 6, 2, 8 // first iteration ... Read More
9K+ Views
Merge Sort The Merge Sort algorithm, where we can sort the elements in a particular order. This algorithm is also considered as an example of divide and conquer strategy. In merge sort algorithm, firstly the array will be divided into two parts and combined a particular sorted manner. The array will be divided into half until it cannot be divided. This means that if the array is completely divided and cannot be further divided, the dividing will be stopped. We divide the arrays into halves and implement merge sort on each of the halves. This algorithm is a ... Read More
2K+ Views
An array in JavaScript is an datatype which contains similar types of data. A number array is defined as the array object with numbers as its content. These numbers are divided into even and odd types on a basic level of mathematics. In this article, we will look into outputting the even number of any number array. Syntax let arr = [val1, val2, val3, …]; Now, let us consider an array arr with numbered elements and print the content in the 0th index − Example let ... Read More
1K+ Views
Array is an object which contains multiple values of the same datatype in a sequential order. In other words, we can say that an array is a special type of object in the JavaScript. SyntaxWe can create an array in two ways in JavaScript. The syntax are given below − var arr = [val1, val2, …]; var arr = new Array(“val1”, “val2”, …) Now let us look at a simple JavaScript program to create an array and print its index values − var arr = [1, 2, 3, 4, 5]; document.write(arr[0]); Here, the program returns the content in ... Read More
338 Views
There are several uses of Bootstrap as a framework since it offers design templates based on HTML and CSS technology covering the structure of a webpage and its visual and aural layout for various devices. Bootstrap also supports plugins for JavaScript and its design templates include variables like navigation, typography, tables, image carousels, buttons, forms, models and many more.For Creating LayoutsToday, most developers prefer Bootstrap for creating layouts because it has a highly responsive CSS that sets easily across both mobile devices as well as desktop and laptop computers. When it comes to browsers, Bootstrap adjusts seamlessly with most of ... Read More
93 Views
The toString() function of the TypedArray object returns a string representing the contents of the typed array.SyntaxIts Syntax is as followstypedArray.toString();Example Live Demo JavaScript Example var typedArray = new Int32Array([111, 56, 62, 40, 75, 36, 617, 2, 139, 827 ]); var result = typedArray.toString(); document.write("Contents of the typed array: "+result); OutputContents of the typed array: 111,56,62,40,75,36,617,2,139,827
84 Views
The subarray() function of the TypedArray object returns portion of the current array. It accepts two numbers representing the start and end of the sub array.SyntaxIts Syntax is as followstypedArray.subarray(5, 9)Example Live Demo JavaScript Example var typedArray = new Int32Array([111, 56, 62, 40, 75, 36, 617, 2, 139, 827 ]); var result = typedArray.subarray(3, 7); document.write("Contents of the typed array: "+result); OutputContents of the typed array: 40,75,36,617
94 Views
The slice() method of the typed array object returns a portion or, chunk from the array buffer (as a separate object). It accepts two integer arguments representing the start and end of the portion of the array to be returned.SyntaxIts Syntax is as followsarrayBuffer.slice(3, 8)Example Live Demo JavaScript Array every Method var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]); document.write("Contents of the typed array: "+typedArray); document.write(""); var resultantArray = typedArray.slice(2, 7); document.write("Resultant Array: "+resultantArray); OutputContents of the typed array: 11,5,13,4,15,3,17,2,19,8 ResultantArray: 13,4,15,3,1
51 Views
The set() function of TypedArray object accepts an array a number representing the index and copies the contents of the specified array in to the current array starting at the given index.SyntaxIts Syntax is as followstypedArray.set()Example Live Demo JavaScript Array every Method var typedArray1 = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]); document.write("Contents of the typed array: "+typedArray1); document.write(""); var typedArray2 = new Int32Array([110, 215, 316, 916, 616, 117, 311 ]); typedArray1.set(typedArray2, 3); document.write("Result: "+typedArray1); OutputContents of the typed array: 11,5,13,4,15,3,17,2,19,8 Result: 11,5,13,110,215,316,916,616,117,311
80 Views
The reverse() function of the TypedArray object reverses the contents of a typed array.SyntaxIts Syntax is as followstypedArray.reverse()Example Live Demo JavaScript Array every Method var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]); document.write("Contents of the typed array: "+typedArray); document.write(""); var result = typedArray.reverse(Math.sqrt); document.write("Contents of the reversed array: "+result); OutputContents of the typed array: 11,5,13,4,15,3,17,2,19,8 Contents of the reversed array: 8,19,2,17,3,15,4,13,5,11