How to add a refresh method to a backbone router

While creating a simple web app, where I created an ajax powered form using backbone.js, I needed the ability to clear the form if the user hit the reset button. So, I thought how about if I just refresh the current view. Backbone.js does not have a method to do that, which is a bit counter […]

How to pass loop variables in a JavaScript callback

This is a common problem encountered i.e. if you are making ajax calls in a loop and you need access to the loop index in the AJAX callback, people often hit the JavaScript ‘reference’ behavior i.e. copying or assigning one variable to another merely makes a reference, not a full copy. This even holds for […]

Lesson 11: Scope in JavaScript

In this lesson, I focus on the nitty gritty of Scope and Lifetime of variables in JavaScript Language. JavaScript has similar scoping model as most other C like languages with a minor difference in that it does not have block scope. Here is the code: 55-scope

Lesson 10: Prototypes in JavaScript

Sorry for the long delay between the last lesson and this one. Lots of travel and work got in the way of this post. Without further ado, here is the lesson on Prototypes. Prototype is much misused keyword in JavaScript. Prototype word in JavaScript is used interchangeably for two subtly different concepts. This has lead […]

Lesson 9: Constructor Functions

Constructor functions in JavaScript are special functions that allow you to create a factory function that can create many objects of the same type through code reuse. For Object Oriented programmers, constructor functions are a familiar concepts. The code for this lesson is here:  Constructor Functions

Lesson 8: JavaScript Functions

JavaScript functions are what gives Javascript its power. With JavaScript functions, you can break down your code into small modules which, helps with readability, debuggability and reusability of code. JavaScript functions double up as objects as well. Here is the code file for this sample: 50-functions.js      

Lesson 7: Assignment 1 – Etch-a-Sketch and CScript

Hello and Happy New Year! I am back in the new year with the first blog entry that will exercise your mind and give you some hands on experience as you progress through it. Reading input using node.js is not straightforward, and hence, in this assignment, I am having you guys use this tool called […]

Lesson 6: Arrays in JavaScript

Arrays are one of the built in DataTypes in JavaScript. They are on par, if not more useful than Objects. Arrays in JavaScript perform the function of Arrays and Lists/Vectors in other languages. Arrays allow you to traverse their contents in a serial manner using an index or allow random access to any element contained […]

Lesson 5: Basics of Source Control with Git

In this lesson, I go over the basics of Source Control. Source Control is the way professional Software Developers maintain their code. Even though it is probably one of the most useful tools to learn when you start software development, for some reason, most colleges never teach this. Here, I am introducing you to Source […]

Lesson 4: JavaScript Objects

Lesson 4 is about JavaScript Objects. JavaScript is an Object Oriented Language and objects in JavaScript are one of the foremost core concepts. Objects allow you to group data together and provide you with the flexibility and power of creating containers that help you make your programs Modular and Elegant. The code for this lesson […]