Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

loop through nested json object typescript

var catalog = 
{
    "products": [
        {
            "name": "prod 1",
            "versions": [
                "ver 1",
                "ver 2"
            ]
        },
        {
            "name": "prod 2",
            "versions": [
                "ver 1",
                "ver 2"
            ]
        }
    ]
};

for(var i = 0; i < catalog.products.length; i++)
{
    var product = catalog.products[i];
    var productName = product.name;
    for(var j = 0; j < product.versions.length; j++)
    {
        var version = product.versions[j];
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: for:each in lwc js 
Javascript :: how to make a check if 50% of letters are capital in discord js 
Javascript :: Sequelize.Op; 
Javascript :: jquery fadein to show modal 
Javascript :: feet to mile js 
Javascript :: abrir dialog angular material 
Javascript :: javascript continue with for Loop 
Javascript :: hackerearth javascript solutions 
Javascript :: add in to array mongoose 
Javascript :: search through json for key 
Javascript :: export app react native 
Javascript :: How to convert a canvas to an image javascript 
Javascript :: javascript optional add object key 
Javascript :: why does an array index start at 0 
Javascript :: socket.io cdn 
Javascript :: find max number in java 
Javascript :: react 18 rendering twice 
Javascript :: javascript filter array by groups of highest 
Javascript :: get the length of an object vuejs 
Javascript :: Mongoose filter by multiple fields 
Javascript :: js iife 
Javascript :: javascript await return value 
Javascript :: js array split by comma 
Javascript :: slick js function 
Javascript :: anguler test submit form 
Javascript :: JavaScript next() Method 
Javascript :: angular retry interceptor 
Javascript :: create primary key in mongodb 
Javascript :: javascript array.contains 
Javascript :: prevent click on pseudo element javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =