In Depth - The "new" Operator In JavaScript


#1

Building A Mental Model For Precedence And The “new” Operator In JavaScript
By Ben Nadel

For the most part, when I write JavaScript code, I try to be mindful. Which means that when I write JavaScript code - or any code for that matter - I never want to rely on operator precedence. This is for me; but, it’s just as much for the next engineer who has to maintain my code. As such, I am very liberal with my use of parenthesis so as to add clarity to the way in which an expression will be evaluated. That said, the one case in which I do tend to lean on operator precedence is when using the “new” operator for constructing object instances.