What does this JavaScript code in codiqa.ext.js do?

147 views Asked by At

I have never seen JavaScript written in this way (with a "randomword: function(){}"). What does this "randomword: function(){}" syntax actually do? Is this ECMA standards JS?

Excerpt of codiqa.ext.js below:

  init: function() {
    for(var type in this.types) {
      this.types[type].prototype.initType();
    }
  },

  refresh: function() {
    for(var x in this.instances) {
      this.instances[x].refresh && this.instances[x].refresh();
    }
  },

  callbackInit: function() {

  },
1

There are 1 answers

0
geoyws On

Sorry guys, the code snippet IS part of an object literal notation.

window.CodiqaControls = {
  define: function() {},
  register: function() {},
  init: function() {}
};

This is a duplicate question of Javascript 'colon' for labeling anonymous functions?

Question solved.