Add element into javascript "dictionary" array
arrays, javascript, jquery
Solution
Is this what you are looking for?
for (var i = 11; i < 42; i++) {
dict[i] = 0;
}
If you want to include `42` per your question, then change the `<` to a `<=`.
Problem
I got a dict object structure like this: ``` var dict = { 11: 0, 12: 0, 13: 0 ... }; ``` I want to do this: ``` for (var i = 11; i < 42; i++) { dict.Add(i, 0); } ``` But I do know "Add()" is not a function defined on the dict object. So, how can I do it insead of manully write 11~42 line by line?