Answers for "js function within object"

3

js functions inside of objects

var person = {
  name: "Fred",
  sayName: function() {
    console.log(this.name);
  }
};

person.sayName();
Posted by: Guest on March-08-2020
3

function inside object javascript

var obj = {
  func: function(a, b) {
    return a * b;
  }
};

obj.func(3, 6); // 18
Posted by: Guest on May-20-2020

Code answers related to "js function within object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language