Reputation: 23
How to print the index number like this?
Array[0] = Yasir
Array[1] = Ahmed
Array[2] = Yousuf
Upvotes: 2
Views: 136
Reputation: 1785
If you have data as an array of names, this will work for you:
arr.map((El,index) => `Array[${index}]-${el}`))
Upvotes: 2