Return to the homepage

Author Archive

Optimizing for loop in javascript

Posted by Sunil Lukose on Oct 22, 2008

We normally don’t pay much attention when it comes to writing simple loops and assigning variables.

Here I would like to show two ways of writing a simple code that alerts an array’s value.

var arr = new array(”red”,”green”,”blue”);
var len = arr.length;
for(var i=0; i<len; i++) {
var value = arr[i];
alert(value);
}

You could write the same script in a more [...]

Cool Javascript based site

Posted by Sunil Lukose on Oct 9, 2008

Recently I came across a site that was programmed fully using JavaScript. The whole site is single page and with the help of JavaScript you scroll around the site. It’s pretty well done and you should check it out.
Link to the site