0
let x = process.argv[2] || "abc";

I am new to javascript. I don't think || is a boolean OR operator here. What does this line mean? Why using OR on some strings? Does this mean if process.argv[2] is null, then assign "abc" to x?

3
  • This is a boolean or gate. If the contents of process.argv[2] is falsy (process.argv[2] == false) then it will assign "abc" to x instead. Commented Jul 3, 2017 at 13:38
  • 1
    You inspired from this (asked few min ago) ? stackoverflow.com/questions/44885901/… Commented Jul 3, 2017 at 13:39
  • Logical_operators Commented Jul 3, 2017 at 13:39

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.