The JavaScript new operator

In the last post I was changing some C# code to JavaScript but there was one part that I just dropped and didn’t explain why, and that was the use of the new operator.
While JavaScript isn’t a classical language, it’s prototypal, and …

In the last post I was changing some C# code to JavaScript but there was one part that I just dropped and didn’t explain why, and that was the use of the new operator.
While JavaScript isn’t a classical language, it’s prototypal, and doesn’t have a notion of classes (yet), but it does have a new operator. What’s interesting is it’s an operator like C# (see 14.5.10 of the spec, yep I looked it up :P), and operators tend to do something unique which is also the case with JavaScript new.


Print Share Comment Cite Upload Translate
APA
Posts on LINQ to Fail | Sciencx (2024-03-29T09:54:01+00:00) » The JavaScript new operator. Retrieved from https://www.scien.cx/2013/07/14/the-javascript-new-operator/.
MLA
" » The JavaScript new operator." Posts on LINQ to Fail | Sciencx - Sunday July 14, 2013, https://www.scien.cx/2013/07/14/the-javascript-new-operator/
HARVARD
Posts on LINQ to Fail | Sciencx Sunday July 14, 2013 » The JavaScript new operator., viewed 2024-03-29T09:54:01+00:00,<https://www.scien.cx/2013/07/14/the-javascript-new-operator/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » The JavaScript new operator. [Internet]. [Accessed 2024-03-29T09:54:01+00:00]. Available from: https://www.scien.cx/2013/07/14/the-javascript-new-operator/
CHICAGO
" » The JavaScript new operator." Posts on LINQ to Fail | Sciencx - Accessed 2024-03-29T09:54:01+00:00. https://www.scien.cx/2013/07/14/the-javascript-new-operator/
IEEE
" » The JavaScript new operator." Posts on LINQ to Fail | Sciencx [Online]. Available: https://www.scien.cx/2013/07/14/the-javascript-new-operator/. [Accessed: 2024-03-29T09:54:01+00:00]
rf:citation
» The JavaScript new operator | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2013/07/14/the-javascript-new-operator/ | 2024-03-29T09:54:01+00:00
https://github.com/addpipe/simple-recorderjs-demo