Map an object's keys to an array using $.map

Map an object's keys to an array using $.map

Hi there,

I read here  api.jquery.com/jquery.map/ that you can map an object's keys to an array like this


  1.     
    var dimensions = { width: 10, height: 15, length: 20 };
    var keys = $.map( dimensions, function( value, key ) {
    return key;
    });
and the result should be this:

  1. [ "width", "height", "length" ]

But I get ["0","1","2"] which looks like the index values.  Here is the JSfiddle

Can you see what I'm doing wrong?

Thanks