Archive for September, 2009

Javascript 1.8 forEach – supported in Safari, Firefox and beyond

If you don’t have to support IE, you can start taking advantage of JavaScript 1.8 features such as the forEach construct. It’s nicer than a conventional for loop when you are iterating over every item in an array. Read the rest of this entry »

  • Share/Bookmark

No Comments

Random Integer Javascript snippet

returns a random number between two digits passed in as arguments.

function randomInteger(low, high)
{
    return low + Math.floor(Math.random() * (high - low));
}
  • Share/Bookmark

No Comments