var fruits = []; fruits.push(\"lemon\", \"lemon\", \"lemon\", \"lemon\");
Instead of pushing same elements how can write it once like this:
You shouldn't use the array constructor, use [] instead.
[]
const myArray = []; // declare array myArray.length = 5; // set array size myArray.fill('foo'); // fill array with any value console.log(myArray); // log it to the console