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

130
Vistas
different between a class field and constructor properties

I understand that class constructor properties will be assigned to the instance of the newly created object like so, but what is the different between the 2 code both of them will add isAdmin to the object

class User {
    constructor(name) {
        this.isAdmin = false
        this.name = name
    }
}

now with a class field

class User {
    isAdmin = true
    constructor(name) {
        this.name = name
    }
}

object will have both properties either way, so what is the difference?

const user = new User('john')

console.log(user)
{ isAdmin: true, name: "john" }
about 4 years ago · Juan Pablo Isaza
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