-2
rated 0 times
[
5]
[
7]
/ answers: 1 / hits: 68497
/ 14 Years ago, wed, january 5, 2011, 12:00:00
I've got an object:
var obj = {
Mike: 24,
Peter: 23,
Simon: 33,
Tom: 12,
Frank: 31
};
I want to create an array that holds the values of the object. The keys (key names) can be disregarded:
[24, 23, 33, 12, 31]
The order of the values is NOT important!
One solution (obviously) would be do have a function that takes the values and puts them into an array:
var arr = valuesToArray(obj);
I will accept such a function as the answer. However, I would be more pleased if there would be an API function (ECMAScript, jQuery, browser-specific, ...) that could do this. Is there such a thing?
More From » jquery