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.

  • Custom User Avatar

    I might be incorrect, but I believe these 2 are the same thing?