Will Huang
Will Huang

Reputation: 323

Javascript notation

I came upon a notation I'm not too familiar with and would like some direction to where to look.

the notation is "selector event" : function() {}

so for example

".elementClass change" : function() {}

Upvotes: -1

Views: 116

Answers (1)

Konstantin Dinev
Konstantin Dinev

Reputation: 34895

This notation is for a key-value pair within an object. The specific example is for a function value belonging to a selector and event key. The function is then accessible using the key:

var obj = {
    ".elementClass change": function () {}
};
var func = obj[".elementClass change"];

Upvotes: 1

Related Questions