0
let a=5
let b=10

//a,b=b,a
[a,b]=[b,a];
console.log(a,b);

**[a,b]=[b,a]; ^

ReferenceError: Cannot access 'b' before initialization at Object. (C:\javascript\Telusko\swap.js:5:4)
**

i dont why iam getting this error, can anyone help me.

0 Answers0