daveywc
daveywc

Reputation: 3146

Javascript Syntax Explanation - Conditional?

Can someone please explain what the following javascript statement is doing?

var default_hide = {"grid": true };

It looks like some sort of conditional statement similar to a ternary statement?

Upvotes: 1

Views: 70

Answers (2)

Humberto Zapata
Humberto Zapata

Reputation: 1

It's declaring a object named "default_hide", with one property named "grid" and its corresponding value "true".

After this declaration, you can do: document.write(default_hide.grid);

Upvotes: 0

alex
alex

Reputation: 490597

It's defining an object with a grid property that is set to true which is being assigned to default_hide.

In that context, the braces are defining an Object.

Upvotes: 1

Related Questions