WeakMap set() JavaScript

The JavaScript WeakMap set() method is used to add or modify the key-value pairs to the WeakMap object. The key must be unique. Syntax: WeakMapObj.set(key,value) Parameters: key: It represents the key of the element to be added or modified. value: It represents the value of the element to be added or modified. Returns: Updated WeakMap … Read more

WeakMap has() JavaScript JS

The JavaScript WeakMap has() method to find out if the WeakMap object contains the specified value element. Syntax: WeakMapObj.has(key) Parameters: key: It represents the key to be found in the WeakMap object. Returns: It returns true if the given key is present in the WeakMap, otherwise returns false. Example 1: <!DOCTYPE html> <html> <body> <script> … Read more

WeakMap get() JavaScript

The JavaScript WeakMap get() method is used to retrieve the value of a specified key. Syntax: WeakMapObj.get(key) Parameters: key: It represents the key of the element to be retrieved from the WeakMap object. Returns: It returns the value of a specified key Example 1: <!DOCTYPE html> <html> <body> <script> var hello = new WeakMap(); var … Read more

WeakMap delete() JavaScript

The JavaScript WeakMap delete() method deletes the specified element from a WeakMap object. Syntax: weakMapObj.delete(key); Parameters: key: It represents the element to be removed from the WeakMap object. Returns: It returns if the specified element is removed successfully, otherwise returns false. Example 1: <!DOCTYPE html> <html> <body> <script> var hello = new WeakMap(); var obj … Read more

TypedArray toLocaleString() JavaScript

The Javascript TypedArray toLocaleString() method transforms the elements of an array into a locale-specific string. All elements of the array will be separated by a comma (,). Syntax: array.toLocaleString() Parameters: total: It represents the previously returned value of the function. currentValue: It represents the index position of the current element. index: It represents the index … Read more

TypedArray values() JavaScript

The Javascript TypedArray values() method determines the values of the elements of an array. Syntax: array.values() Returns: It returns the values of array elements. Example: <!DOCTYPE html> <html> <body> <script> var num = new Uint8Array([31,32,34,53,83]); var n = num.values(); document.write(n.next().value + “<br>”); document.write(n.next().value + “<br>”); document.write(n.next().value + “<br>”); document.write(n.next().value + “<br>”); document.write(n.next().value); </script> </body> </html>

TypedArray subarray() JavaScript

The Javascript TypedArray subarray() method is used to get a new array of selected elements without changing the original array. Syntax: array.subarray(start, end) Parameters: start: It represents the index position where to start the selection. end: It represents the index position where to end the selection. Returns: It returns a new array of selected elements. … Read more

TypedArray some() JavaScript

The Javascript TypedArray some() method is used to examine the elements of an array according to a given condition. Syntax: array.some(function(value, index, arr), thisValue) Parameters: value: It represents the current element’s value. index: It represents the index position of the current element. arr: It represents the array on which some() method have to be called. … Read more