Question: i have a set of code that i copied from someone on youtube and i completely understand and there is some unused logic in there but basically at the moment all it is meant to do is grab the rocket.show function and draw a rectangle and i cannot for the life of me work out why it is not doing so. it is throwing out no errors and drawing the background, i can draw the rectangle if i just put the code for "rect..." in the draw function therefore there is a problem with the way that i am referring to the function but i cannot for the life of me work it out, the code is below, any help would be appreciated.

```
function setup() {
    createCanvas(800, 600);
    background(0);
    rocket = new rocket();
}

function draw() {
    rocket.update;
    rocket.show;
}

function rocket() {

    this.pos = createVector();
    this.vel = createVector();
    this.acc = createVector();

    this.applyforce = function (force) {
        this.acc.add(force);
    }

    this.update = function () {
        this.vel.add(this.acc);
        this.pos.add(this.vel);
        this.acc.mult(0);
    }

    this.show = function () {
        push();
        translate(this.pos.x, this.pos.y);
        rotate(this.vel.heading());
        rectMode(CENTER);
        rect(0, 0, 10, 50);
        pop();
    }
}

```

edit: I worked it out, sorry for taking up needless posting space

Answer: 
You should check for the *first* property that might not exist: so don't check the `coconut.color` property before you are sure that `coconut` exists. 

If the property you check for should be an object (which is your case) then you can do so with the `!` operator:

```
if (!myObj.fruits.coconut) myObj.fruits.coconut = { color: 'brown' };

```
Underscore js contains **\_.has** [link](http://underscorejs.org/#has)

> 
> \_.has(object, key) 
>  Does the object contain the given key? Identical to object.hasOwnProperty(key), but uses a safe reference to the hasOwnProperty function, in case it's been overridden accidentally.
> 
> 
> 

```
_.has({a: 1, b: 2, c: 3}, "b");
=> true

```

Obviously, hackerrdave answer is suffice, but if you're using underscorejs then it's slightly simpler.