array.entries() is a built-in function in How to use entries function, used to obtain a new Array containing the key and value pairs of each index of the array. Let's look at the specific use of the entries function.
Let’s first look at the basic syntax of the entries function
array.entries();
It returns an indexed array and the array.entries() function The value of the given array to operate on.
Let’s look at a specific example
The array.entries() method is used to find the key and value pair for each index in any given array.
The code is as follows
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <script type="text/javascript"> var array = ["php", "gfg", "Jhon"]; var iterator = array.entries(); console.log(iterator.next().value); console.log(iterator.next().value); console.log(iterator.next().value); </script> </body> </html>
The execution effect is as follows:
The above is the detailed content of How to use entries function. For more information, please follow other related articles on the PHP Chinese website!