[Solved] How to create an array with counter?


You declare myElement, but it is just null. In your function, trying to set an index of a null variable will do nothing. Additionally, you should increment after using the value, otherwise you miss out on the 0th element.

var myElement = [];
var countElement = 0;

function wikiParsed(langPrefixElement) {
  myElement[countElement++] = countElement;
}
wikiParsed();
wikiParsed();
wikiParsed();
console.log(myElement);

4

solved How to create an array with counter?