array[array.length]=1 replaced with array.push(1)