4

When I enter _ into a nodejs terminal, I get "undefined", but when I type in x, I get a reference error. I thought underscores were just another character, why am I getting different results?

$ nodejs
> _
undefined
> x
ReferenceError: x is not defined
> 

I thought both would give me a reference error.

Phil
  • 141,914
  • 21
  • 225
  • 223
Ryan McGrath
  • 1,094
  • 8
  • 10

1 Answers1

3

In node.js, _ would return last expression's result.

If you try to using _ as first command, it will return undefined.

lsv
  • 756
  • 4
  • 14