I want to store the arguments of abc(10)
andabc(15)
which is 10 and 15 respectively inside an array var store = []
.
var store = [];
function abc(a){
for (var i = 0; i < 2; i++) {
store[i] = a;
}
console.log(store)
}
abc(10)
abc(15)
Above code's console.log(store)
gives me this array [10, 10]
and [15, 15]
. I want one single array [10, 15]
and so on if I call abc(20)
20 array must be added to array and outputs [10, 15, 20]
.