var num = new Array(10) var a = 1; (function createCards () { for (var s = 0; s <= 9; s++) { cards[s] = a++; } })(); console.log(z)