Blog Archives

JavaScript – A Different Beast, Part-8: Array, Map and the for..in loop

Previous topic in this series: Inheritance without Classes

This is the eighth part of my tutorial on JavaScript. Focus of this series is to introduce developers who are comfortable with other programming languages like Java or C to the idiosyncrasies of JavaScript. Basic JavaScript knowledge is assumed, but is not necessary as the code samples are simple and self-explanatory. If you are new to JavaScript, I would suggest going through the topics below in the order given.

Topics:

  1. A different beast
  2. Types and Type Conversion
  3. Functions
  4. Scopes and Scope Chain
  5. Closures
  6. Objects without Classes
  7. Inheritance without Classes
  8. Array, Map and the for..in loop (You are here)
  9. Literals and JSON
  10. Meta-Programming, Exceptions and Module Pattern

This is probably the simplest topic in the whole series, but it is not without some thrills. Arrays and Maps are the most popular data-structures in any programming language. JavaScript provides Array as a first class language element, but for Maps it forces us to do a few neat tricks. Read the rest of this entry

%d bloggers like this: