function getArray(num) {
if (num === 4) {
return [4, 4, 4, 4]
}
else {
return 1
}
}
let x = 2
x = getArray(4)
[2].toFixed(0), x = x
console.log(x) // ??
What will the console output be?
This is a question for fans not to write semicolons.
The string [2].toFixed(0), x = x takes the third element from the array.
It should also be noted that the comma operator has the lowest priority, so assignment is performed first.