Is there any fundemental differnces between these two constructor functions?

  • # July 26, 2012 at 10:35 pm

    function Person(first, last) {
    this.firstName = first;
    this.lastName = last;
    this.full = function() {
    return this.firstName + ' ' + this.lastName;
    }
    }

    function Person(first, last) {
    return{
    firstName : first,
    lastName : last,
    full : function() {
    return this.firstName + ' ' + this.lastName;
    }
    }
    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed