Skip to content
Advertisement

How do I loop through similar key value pairs(a0,a1,a2) in JavaScript object and generate a new array without the number in the key(a)?

What I have
1.keys: similar key name(such as a0,a1,a2)
2.obj: a lot of similar key-value pairs in one object
3.number: the times similar key-value pairs looped in obj1)
4.arr: a array without the number in the key(only keep “a”, no “a0″,”a1″,”a2”)

p.s. “aa”,”bb”,”cc” are examples, the value can be anything

JavaScript

What I want

JavaScript

How can I get array?

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement