JavaScript TypedArray fill() methodThe JavaScript fill() method is used to fill all the elements of array from a start index to an end index with a static value. Syntax:Parameters:Value(Required): The value to fill the array. Start(Optional): The index to start filling the array(default is 0). End(Optional): The index to stop filling the array (default is array.length). Return value:This function does not return a new array. Instead of, it transform the array on which this function is applied. Browser Support:
Example 1JavaScript TypedArray fill(value) method Test it NowOutput: 20,20,20,20,20,20,20,20,20,20 Example 2JavaScript TypedArray fill(value,start) method Test it NowOutput: 1,2,20,20,20,20,20,20,20,20 Example 3JavaScript TypedArray fill(value,start,end) method Test it NowOutput: 1,2,20,4,5,6,7,8,9,10 Next TopicJavaScript TypedArray Object |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India