Timeline for Avoiding new operator in JavaScript -- the better way
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 9, 2011 at 17:52 | vote | accept | treecoder | ||
| Nov 9, 2011 at 17:47 | comment | added | treecoder | Thanks @psr. And @Raynos your Object.create shim is pretty much my third solution but less complicated and better looking than mine of course. | |
| Nov 9, 2011 at 17:34 | history | edited | Raynos | CC BY-SA 3.0 | added 218 characters in body |
| Nov 9, 2011 at 17:26 | comment | added | treecoder | Yes I did read that. And I think (IF) they're using some kind of __proto__ thing there, then we're still on the same point. Because pre ES5 there's NO easier way to mutate the prototype. But anyway, your solution seems most elegant and forward looking. +1 for that. (my voting limit is reached) | |
| Nov 9, 2011 at 17:17 | comment | added | Raynos | @greengit if you read it again, ES5 shim states the second argument to Object.create is DUBIOUS. the first one is fine. | |
| Nov 9, 2011 at 17:14 | comment | added | treecoder | Yes true -- but all the magic here is because of Object.create. What about pre ES5? ES5-Shim lists Object.create as DUBIOUS. | |
| Nov 9, 2011 at 17:06 | history | answered | Raynos | CC BY-SA 3.0 |