I’m pretty new to plain old JavaScript and to JavaScript frameworks (such as Backbone.js, RequireJS, …). As I was reading and trying to understand some JavaScript files that I got from a project at work (based on JQuery, Backbone and Require), I’ve encountered some variable declarations such as:
var myVariable = {}, itemList;
Could someone explain to me what the “{}” is?
PS: might be a silly question but it’s definitely not that easy Googling for “{}” as keyword…
Thanks in advance.
It’s an empty Javascript object literal (A shorthand way of creating an object)
is similar to
Both expressions will create an empty object.