-1

In C++, I normally use the 'word' operators:

  • not instead of !
  • and instead of &&
  • or instead of ||

For me it is just easier to read especially the not when negating statements.

Is there any way to do this in Javascript/NodeJS/VueJS?

kzaiwo
  • 1,558
  • 1
  • 16
  • 45
  • And why the downvote? – kzaiwo Apr 22 '20 at 07:27
  • These are just [infix functions](https://en.wikipedia.org/wiki/Infix_notation) and unfortunately JS doesn't allow defining/aliasing/overriding them. see [here](https://stackoverflow.com/questions/12350790/is-it-possible-to-define-an-infix-function). – Xaqron Apr 22 '20 at 07:33
  • Wasn't my downvote but I'd expect it because it's a question with doubtful reasoning that could be solved by simple search. No, there's no way, JS tries to keep the syntax simple and short. FWIW, it wasn't a good C++ habit after all, C++ allows this at the expense of bloated lang spec, bracket languages weren't designed for natural language. If you're not happy with JS ways you can try some derived language with different syntax, Coffeescript has human-readable logical operators, https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS – Estus Flask Apr 22 '20 at 07:55

1 Answers1

0

No. In javascript / nodejs there is no way for logical operators to use an actual word instead of an operator symbol

Atharva Jawalkar
  • 166
  • 1
  • 12