TypedArray entries() JavaScript

The Javascript TypedArray entries() method is used to get a new Array Iterator object that contains key-value pairs for each index in the array. The Array index is represented by a key and the array item is represented by value.

Syntax:

array.entries()  

Returns: Array Iterator object.

Example:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var Jewels = ["DIAMOND","GOLD","PLATINUM","SILVER"];
var gems = Jewels.entries();
document.write(gems.next().value + "<br>");
document.write(gems.next().value + "<br>");
document.write(gems.next().value + "<br>");
document.write(gems.next().value);
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com