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

284
Vistas
What is Javascript 'of' operator

I was learning about Object.entries in Javascript and I came across the following code snippet:

const object1 = {
  a: 'somestring',
  b: 42
};

for (const [key, value] of Object.entries(object1)) {
  console.log(`${key}: ${value}`);
}

// expected output:
// "a: somestring"
// "b: 42"

we can see that there is a "of " keyword used in here; can anyone tell me how it works?

for (const [key, value]  of Object.entries(object1)) {
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The of keyword is usually used to iterate through iterable objects (in this example you have given, is the object of Object.entries).

For more explanations and examples, you can find out from this documentation by Mozilla.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

Edited according to VLAZ comment: There is no of keyword nor is it a standalone thing. It's only a part of for..of and for await..of statements.

about 4 years ago · Juan Pablo Isaza Denunciar

0

The for...of loop, which iterates over property values, is a feature added to the JavaScript specification in ECMAScript 2015.

Please look at this post:

JavaScript `of` Keyword (for...of loops)

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