July 13, 2023
Program to use JavaScript Array keys() method
let a = ["JavaScript","Python","Php","Css","Html"];
let b = a.keys();
for(let key of b){
console.log(key);
}
Output
0
1
2
3
4
Steps Description
- Declare three variable
a, b
andkey
- Initialize three variable with value of array
a = ["JavaScript","Python","Php","Css","Html"], b = a.keys()
andkey
- Array
keys()
method returns the index number of the given array. - The value of
key
variable is displayed with the help of console.log inbuilt function
by : Suhel Akhtar
Quick Summary:
JavaScript Array keys() method