The output of this program would be 3.
The sizes array initially contains three elements: "mini", "small", "medium". When you try to push a value to the array using the syntax sizes.push() = "large", it will throw an error as you cannot assign a value to the result of the push() method.
Therefore, the sizes array remains unchanged and still contains the original three elements, resulting in a length of 3.
What is the output of this program?
let sizes = [
"mini",
"small",
"medium"
];
sizes.push() = "large";
console.log(sizes.length);
1 answer