Priority of JavaScript

clipboard.png
Why does new do modify the this binding? isn"t the function of new to create an object and attach the returned value to the object, or bind the this to the object of var? it should not do anything to obj1.a, should it?

Dec.09,2021

look here. The sentence

bar as an ordinary function, its this has been bound to obj1;
but ins
ide the constructor, this points to the newly created object; the
new keyword gives you three things:
var o = new Object ();
this = o;
.
return o;
this is thus changed;
therefore, bar does not return a value, but you can get an instance as a constructor.


call foo.bind (obj1) to get bar,. When you perform bind, apply or call operations on bar, you cannot change the obj1, that bar has bound, but you can change it with new.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb2e31-240d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb2e31-240d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?