Why do i get the error
TypeError: Cannot set properties of undefined (setting '6')
at Object.<anonymous> (/home/runner/*******/index.js:5:8)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
in my code that I tried to swap varibles' content using the destructuring assignment i got that error and im shure that there is no misstaque and I'm not that great of a dev so please help me my code "formated":
let [a,b] = [8,6];
console.log("a:" ,a ,"b:", b)
[a, b] = [b, a]
console.log("a:" ,a ,"b:", b)
the result "try it your self please":
a: 8 b: 6
TypeError: Cannot set properties of undefined (setting '6')
at Object.<anonymous> (/home/runner/seeing-what-is-js/index.js:5:8)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
Missing semicolon after console.log call
automatic semicolon insertion (JS) read it up for more informations.