I'm running the following code:
const [a, b] = [1, 2]
const [c, d] = [3,4]
[a,b] = [b, a]
console.log(a, b, c, d)
Expected Result:
2,1,3,4
Actual Result:
1,2,2,1
I understand that putting semicolons at the end of each line will fix the problem, but I don't understand why I'm getting the result that I get, could someone explain why this happens?