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

139
Views
getting SyntaxError: Invalid shorthand property initializer (This isn't spam and i don't have other people mistakes who posted the same question)

I just started learning js. And I run to this exception: SyntaxError: Invalid shorthand property initializer

This is my code:

const movie = {
    title: 'a',
    releaseYear = 2018,
    rating: 4.5,
    director: 'b'
};
showProperties(movie);

function showProperties(obj){
    for (let key in obj){
        if (typeof obj[key] === 'string')
            console.log(key, obj[key]);
    }
}

What is wrong with this code? I checked other people who got this error on their js code but i didn't have none of their mistakes.

What should I do?

Thanks.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Right Code :

const movie = { title: 'a', releaseYear: 2018, rating: 4.5, director: 'b' };

hi you have to use : instead = in line 3. That's why it happened

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!