I am a JS Beginner. I was going through a code to understand usage of this keyword in Javascript. But i didnt understand the flow and how output came what it is.
<html>
 <body>
  <script>
      function WhatIsThis() {
          return this;
      }
      function Something() {
          this.whatIsThis = WhatIsThis;
          this.toString = function () { return "[Something]" };
      }
      var o = new Something();
      document.writeln("o.whatIsThis() = " +
    o.whatIsThis());
      document.writeln("<br />");
      document.writeln("WhatIsThis() = " +
    WhatIsThis());
      document.writeln("<br />");
      document.writeln("WhatIsThis.call(314) = " +
    WhatIsThis.call(314));
  </script>
 </body>
</html>
Though i debugged it,but couldnt understand. Please Help.
Output:
o.whatIsThis() = [Something] //how it came?
 WhatIsThis() = [object Window] 
 WhatIsThis.call(314) = 314 
 
     
     
    