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
  • 157,677
  • 23
  • 242
  • 245
Ryan McGrath
  • 2,180
  • 1
  • 11
  • 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
  • 776
  • 5
  • 15