Blog Archives

JavaScript – A Different Beast, Part-9: Literals and JSON

Previous topic in this series: Objects without Classes

This is the ninth 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
  9. Literals and JSON (You are here)
  10. Meta-Programming, Exceptions and Module Pattern

JSON is the preferred messaging format of the web these days. JSON has its origin in the object and array literals in JavaScript. This post will discuss literals first and the move onto its textual cousing – JSON.

Read the rest of this entry

JavaScript – A Different Beast, Part-7: Inheritance without Classes

Previous topic in this series: Objects without Classes

This is the seventh 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 (You are here)
  8. Arrays, Maps and the for..in loop
  9. Literals and JSON
  10. Meta-Programming, Exceptions and Module Pattern

JavaScript employs Prototypical Inheritance (also called Differential Inheritance) as opposed to classical inheritance used in classical object oriented languages like Java or C++. It operates on the principle Read the rest of this entry

JavaScript – A Different Beast, Part-5: Closures

Previous topic in this series: Scopes and Scope Chain

This is the fifth 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.


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. Arrays, Maps and the for..each loop
  9. Literals and JSON
  10. Dynamic Programming, Exceptions and Module Pattern

Closures are one of the most esoteric features of JavaScript. Effective usage of closures is a crucial skill needed for web programmers these days. Incidentally, most programmers use them by accident, as we will see shortly. Read the rest of this entry

JavaScript – A Different Beast, Part-4: Scopes and Scope Chain

Previous topic in this series: Functions in JavaScript

This is the fourth 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.


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. Arrays, Maps and the for..each loop
  9. Literals and JSON
  10. Dynamic Programming, Exceptions and Module Pattern

Nested functions

Functions can even be defined inside the body of other functions. This is because functions are first class objects Read the rest of this entry

JavaScript – A Different Beast, Part 3: Functions

Previous topic in this series: Types and Type Conversion

This is the third 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.

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. Arrays, Maps and the for..each loop
  9. Literals and JSON
  10. Dynamic Programming, Exceptions and Module Pattern

JavaScript is a functional programming language (among many other things), which means that functions are treated as first class objects. In plain-speak, it means that functions are treated just like any other value or an object. Read the rest of this entry

JavaScript – A different beast, Part-1: Intro

I wrote this originally to train my project team on JavaScript.  Everyone in the team were good programmers, but JavaScript was still tough for most of them.  That’s when I realized that JavaScript has to be taught formally to even experienced programmers. 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.


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. Arrays, Maps and the for..each loop
  9. Literals and JSON
  10. Dynamic Programming, Exceptions and Module Pattern

Story so far

A long time ago, most of the GUIs for applications were written in Visual Basic, Visual C++, Power Builder and Java Swing. Read the rest of this entry