ZRTECH SOLUTIONS

Best Selling Website Themes

43,00 

Add to cart

6,00 

Add to cart

6,00 

Add to cart

6,00 

Add to cart

Q. What is the object type?

The object type refers to a compound value where you can set properties (named locations) that each hold their own values of any type.

var obj = {
	a: "hello world", // property
	b: 42,
	c: true
};

obj.a;		// "hello world", accessed with doted notation
obj.b;		// 42
obj.c;		// true

obj["a"];	// "hello world", accessed with bracket notation
obj["b"];	// 42
obj["c"];	// true

Bracket notation is also useful if you want to access a property/key but the name is stored in another variable, such as:

var obj = {
	a: "hello world",
	b: 42
};

var b = "a";

obj[b];			// "hello world"
obj["b"];		// 42

Leave a Reply

Your email address will not be published. Required fields are marked *

Best Selling Website Themes

43,00 

Add to cart

6,00 

Add to cart

6,00 

Add to cart

6,00 

Add to cart

0,00 

Add to cart

6,00 

Add to cart