I have the following;
var room = function(){
this.entities = new Array();
}
var myRoom = new room();
I also have a bunch of entites like this;
var entity = function(){
this.title = "A pillow";
this.noun = "pillow";
}
I can push many entities into the myRoom.entities array.
Now I want to check to see whether a room contains a particular entity based on its noun.
I've tried something like this;
var objPillow = myRoom.filter(function (object) { return object.entities.noun == "pillow" });
But it doesn't work.
myRoom.entities? What does “doesn’t work” mean?