1

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?

2
  • It's called an "object literal". Commented Feb 17, 2012 at 0:36
  • eloquentjavascript.net Commented Feb 17, 2012 at 1:15

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks - after hitting post the proverbial "light bulb" turned on and I realised what it was doing. Will accept your answer as soon as I am able. Thanks for you super quick response.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.