'Why do i get the this error if i try this js code? [duplicate]

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)


Solution 1:[1]

Missing semicolon after console.log call

automatic semicolon insertion (JS) read it up for more informations.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mexa