Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In JS, what is this feature called?

I'm trying to learn about this feature of javascript I keep seeing in code, but I don't know the name of the construction to google for...

var Stats = {
  onLoad: function(e) {
    // content
    this.variable++;
  },

  variable: 1
};

Is this way of organising functions and variables based on JSON?

like image 761
Tominator Avatar asked Dec 10 '22 20:12

Tominator


1 Answers

It's an "Object Literal" - see the JavaScript Guide.

like image 105
RichieHindle Avatar answered Dec 26 '22 19:12

RichieHindle