The below code is perfectly valid in JavaScript :-
( { a:10 , b:20 , c:30 } );
But when do we need such an Object which we can’t reference in our code ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You often use an unnamed literal as a parameter to a function call. A popular example is calling jQuery plugin methods on elements, eg:
It is also possible (and often beneficial) to assign such objects to variables beforehand and then passing it in, like so:
But sometimes its just easier and cleaner the first way.