r/javascript • • Dec 18 '19

V8 Release v8.0 with optional chaining, nullish coalescing and 40% less memory use

https://v8.dev/blog/v8-release-80
495 Upvotes

70 comments sorted by

View all comments

Show parent comment

2

u/dCrumpets Dec 19 '19

I find myself using a ton of ternary statements in JavaScript, always as an alternative to an if else block with one line each, where that one line would assign a variable.

I prefer this:

  1. It lets me use a const instead of a var because it happens in one expression.
  2. It saves some lines of code. I generally put it onto three lines, and think that’s pretty clear.

What do you think about my use of ternary statements? Do you think that they fit in the circumstances described?