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 590 of 860
68 Views
The map() function of the TypedArray object accepts the name of a function and calls it on every element of the typed array and returns the results.SyntaxIts Syntax is as followstypedArray.map()Example Live Demo JavaScript Array every Method var int32View = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]); document.write("Contents of the typed array: "+int32View); document.write(""); function square(ele) { return ele*ele; } var result = int32View.map(square); document.write("Specified element occurred at the index: "+result); OutputContents of the typed array: 11,5,13,4,15,3,17,2,19,8 Specified element occurred at the index: 121,25,169,16,225,9,289,4,361,64
63 Views
The lastIndexOf() function of the TypedArray object accepts a value and verifies whether the typed array contains the specified element. If so, this function returns the index of the array at which the specified element found, if the element occurred multiple timed this function returns the last index among them. If the array doesn’t contain the specified element the indexOf() function returns -1.SyntaxIts Syntax is as followstypedArray.lastIndexOf(50)Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55, 66, 97, 66 ]); ... Read More
70 Views
The keys() function of typedArray object is similar to entries but, it returns an iterator object containing the indices of the typed array.SyntaxIts Syntax is as followstypedArray.keys()Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 64, 89, 65, 33, 66, 87, 55]); document.write("Contents of the typed array: "+int32View); document.write(""); var it = int32View.keys(); for(i=0; i
61 Views
The join() function of the TypedArray object joins the contents of the typed array as single string and returns it. To this method you can pass a separator to separates the elements of the array.SyntaxIts Syntax is as followstypedArray.join(':')Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55 ]); document.write(""); var contains = int32View.join(''); document.write("."+contains); document.write(""); document.write(int32View.join(':')); document.write(""); document.write(int32View.join('-')); ... Read More
91 Views
The indexOf() function of the TypedArray object accepts a value and verifies whether the typed array contains the specified element. If so, this function returns the index of the array at which the specified element found, if the element occurred multiple timed this function returns the first index among them. If the array doesn’t contain the specified element the indexOf() function returns -1.SyntaxIts Syntax is as followstypedArray.indexOf(50)Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55, 66, 97, 66 ]); ... Read More
55 Views
The includes() function of the TypedArray object accepts a value and verifies whether this typed array contains the specified element. If the array contains the given element it returns true else, it returns false.SyntaxIts Syntax is as followstypedArray.includes()Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55 ]); document.write("Contents of the typed array: "+int32View); document.write(""); var contains = int32View.includes(66); if(contains) { document.write("Array contains the specified element"); ... Read More
58 Views
The forEach() function of TypedArray object accepts a string value representing the name of a function and executes it per every element in the array.SyntaxIts Syntax is as followstypedArray.forEach()Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 19, 65,21, 14, 66, 87, 55 ]); document.write("Contents of the typed array: "+int32View); document.write(""); document.write("Result: "); function testResult(element, index, array) { document.writeln(element+100); } int32View.forEach(testResult); //document.write("Result: "+result); OutputContents of the typed array: 21,19,65,21,14,66,87,55 Result: 121 119 165 121 114 166 187 155
66 Views
The find() function of TypedArray accepts a string value representing the name of a function, tests whether the elements in the array passes the test implemented by the provided function, if so, returns the index of the first element which passes the test else, returns -1.SyntaxIts Syntax is as followstypedArray.findIndex(function_name)Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55 ]); document.write("Contents of the typed array: "+int32View); document.write(""); function testResult(element, index, array) { ... Read More
53 Views
The find() function of TypedArray accepts a string value representing the name of a function, tests whether the elements in the array passes the test implemented by the provided function, if so, returns the first element which passes the test else, returns undefined.SyntaxIts Syntax is as followstypedArray.find(function_name)Example Live Demo JavaScript Array every Method var int32View = new Int32Array([21, 19, 65, 21, 14, 66, 87, 55 ]); document.write("Contents of the typed array: "+int32View); document.write(""); function testResult(element, index, array) { var ... Read More
66 Views
The filter() function of TypedArray accepts a string value representing the name of a function, tests whether all the elements in an array passes the test implemented by the provided function, creates a new array with all elements that pass the test.SyntaxIts Syntax is as followstypedArray.filter(function_name)Example Live Demo JavaScript Array every Method var int32View = new Int32Array([64, 89, 65, 21, 14, 66, 87, 55 ]); document.write("Contents of the typed array: "+int32View); document.write(""); function testResult(element, index, array) { var ele ... Read More