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

185
Vistas
Can colon (:) be used for assignment in JavaScript?

I'm new in JavaScript. I was programming and I saw some used

const PI : 3.14

I'm puzzled how ':' notion can be used to assign values to variables. Can anyone explain to me when ':' is used to assign values to variables? That'll be really helpful ^^

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

If you are just assigning a variable, you can't use a colon. What you want is const PI = 3.14. Colons can be used for other purposes however, for example, setting keys in an object:

const myObject = {
    key: "my new value"
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

NO! That is the wrong syntax and will throw error in JS.

Either you write

const PI = 3.14;

OR

const Obj1 = {PI: 3.14}

These, are the valid syntax in JS.

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