HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
This is a JSON string
You can create a JavaScript array from a literal:
myArray = ["Ford", "BMW", "Fiat"];
You can create a JavaScript array by parsing a JSON string:
myJSON = '["Ford", "BMW", "Fiat"]';
myArray = JSON.Parse(myJSON);
You access array values by index:
myArray[0];
Objects can contain arrays:
{
"name":"John",
"age":30,
"cars":["Ford", "BMW", "Fiat"]
}
You access array values by index:
myObj.cars[0];
You can access array values by using a for in
loop:
for (let i in myObj.cars) {
x
+= myObj.cars[i];
}
Or you can use a for
loop:
for (let i
= 0; i < myObj.cars.length; i++) {
x
+= myObj.cars[i];
}