简体   繁体   中英

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() {}

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"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM