var fruits = []; fruits.push("lemon", "lemon", "lemon", "lemon");
Instead of pushing same elements how can write it once like this:
fruits.push("lemon" * 4 times)
For primitives, use .fill:
.fill
var fruits = new Array(4).fill('Lemon'); console.log(fruits);
1.4m articles
1.4m replys
5 comments
57.0k users