Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda