Print Array elements with Indexes & Values

Viewed 85

How to print the index number like this?

Array[0] = Yasir
Array[1] = Ahmed
Array[2] = Yousuf

enter image description here

1 Answers

If you have data as an array of names, this will work for you:

arr.map((El,index) => `Array[${index}]-${el}`))
Related