YouTip LogoYouTip

Js Json Arrays

## Nested Arrays in JSON Objects Arrays in JSON objects can contain another array, or another JSON object: ## Example myObj = {"name":"Website", "num":3, "sites": [{"name":"Google", "info":["Android", "Google Search", "Google Translate"]}, {"name":"Tutorial", "info":["", "Tutorial Tools", "Tutorial WeChat"]}, {"name":"Taobao", "info":["Taobao", "Online Shopping"]}]} We can use a for-in loop to iterate through each array: ## Example for(i in myObj.sites){x += "

" + myObj.sites.name + "

"; for(j in myObj.sites.info){x += myObj.sites.info + "
"; }} [Try it Β»](#) * * * ## Modify Array Values You can modify array values using an index number: ## Example myObj.sites = "Github"; [Try it Β»](#) * * * ## Delete Array Elements We can use the **delete** keyword to delete array elements: ## Example delete myObj.sites; [Try it Β»](#)
← Json StringifyVue Routing β†’