Iterate over properties of and object

    [javascript]
    var object =
    {
    a:10;
    b:20;
    s:’hello’
    };

    $.each(object, function(name, value)
    {
    console.log(name+’:’+value);
    });
    [/javascript]

    One Reply to Iterate over properties of and object

    1. mitjag says:

      there is a spelling mistake.
      js object literals cannot have the “;” sign. It must be “,”
      So it is:
      {
      a:10,
      b:20,
      s:’hello’
      }

    Leave a Reply