简体   繁体   中英

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?

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 .

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM