Kamran Abbasi
Kamran Abbasi

Reputation: 23

Print Array elements with Indexes & Values

How to print the index number like this?

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

enter image description here

Upvotes: 2

Views: 136

Answers (1)

cuddlemeister
cuddlemeister

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

Related Questions