Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

280
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!