for(var i=0; i<this.shapes.length; i++){ if(this.shapes[i].id==id) { return this.shapes[i]; } } return null;