Ad
  • Custom User Avatar

    The behavior is the same, but they are not the same thing, in the first sample it's creating a function for each and every object created (waste of memory), while in the second it's adding the function to the prototype, thus one function is being 'shared' by every object.