home

Quickies, by Andrea Olivato

text

Foreach key => val in Javascript

Simple example on how to obtain a key => val cycle for a Javascript Object

var object = { foo: 1, bar: 2, baz: 3 };
[ alert ( key + "=" + obj[val] ) for ( val in obj ) ];

2 years ago

July 22, 2009
Comments (View)
blog comments powered by Disqus