You are on page 1of 1

Arrays

- collections of anything, any type


- because javascript is dynamically-typed

code:
//to declare:
//var arr = new Array();
//or use the array literal syntax
//arr = [];

var arr = [
1,
false,
{
name: 'Tony',
address: '111 Main St.'
},
function(name){
var greeting = 'Hello';
console.log(greeting + name);
},
"hello"
];

console.log(arr);
arr[3](arr[2].name);

out:
[1,false, Object, function, "hello"]
HelloTony

You might also like