var Animal = function(name){
this.name = name;
this.arr = [1,2,3,4];
this.inc = function(num){
return num + 1;
};
this.fireArr = function(){
this.arr.forEach(function(item){
console.log(this.inc(item));
}.bind(this));
};
};
var dog = new Animal("dog");
console.log(dog.fireArr());
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme