Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
hdhzy
on April 14, 2017
|
parent
|
context
|
favorite
| on:
Replacing ‘that = this’ assignments in JavaScript ...
The algorithm for "var p = new Person" is roughly (ignoring prototypes):
var p = {}; Person.call(p); // calls Person with p as this
Remember that in js there are no "methods" just functions. The original constructor function can be accessed by "constructor" property:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: