What is the significance of this JavaScript code? -


what think doing looking see if object has been instantiated , exists within scope? why need use triple equal sign determine?

   function viewmodel(parent) {              if (false === (this instanceof viewmodel)) {                 return new viewmodel(parent);             }      }; 

you don't need strict equality comparison there. instanceof yields true or false, entirely sufficient:

if (!(this instanceof viewmodel)) 

Comments

Popular posts from this blog

java - Incorrect order of records in M-M relationship in hibernate -

command line - Use qwinsta in PowerShell ISE -

php - I want to create a website for polls/survey like this http://www.poll-maker.com/ -