Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda