What is the use of the underscore variable in REPL?

In REPL, the underscore variable is used to get the last result.

C:\Nodejs_WorkSpace>node  

> var x = 10  

undefined  

> var y = 20  

undefined  

> x + y  

30  

> var sum = _  

undefined  

> console.log(sum)  

30  

undefined  

>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *