How do I create an Array into another Array?

Posted by Timnkd on Stack Overflow See other posts from Stack Overflow or by Timnkd
Published on 2010-05-07T21:06:39Z Indexed on 2010/05/07 23:28 UTC
Read the original article Hit count: 231

Filed under:
|

I have the following JavaScript Array:

var jsonArray = { 'homes' : 
[
    {
        "home_id":"203",
        "price":"925",
        "sqft":"1100",
        "num_of_beds":"2",
        "num_of_baths":"2.0",
    },
    {
        "home_id":"59",
        "price":"1425",
        "sqft":"1900",
        "num_of_beds":"4",
        "num_of_baths":"2.5",
    },
    // ... (more homes) ...     
]}

I want to convert this to the following type of Array (pseudo code):

var newArray = new Array();
newArray.push(home_id's);

How can I do that?

Notice how the newArray only has home_ids from the big jsonArray array.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about web-development