Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
Why do i get the this error if i try this js code?

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)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Missing semicolon after console.log call

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!