Skip to content
Advertisement

Add missing keys into array

I have an array like this, with missing keys:

JavaScript

How can I add missing keys to it with empty strings as values? I want this as a result:

JavaScript

Advertisement

Answer

your questions is very vague and hard to understand exactly what you want, from my interpretation it seems you want to insert a key into the array moving the current keys along the index line.

you may want to try something like this:

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