a blog for those who code

Friday, 27 June 2014

Three dots(...) in Nodejs

In this post we will tell you whats the meaning of Three Dots (...) in Nodejs. If you are executing your code in Node.exe you might be getting three dots (...), this is node.exe mode of handling multiline expressions.
Node.exe provides you a textual indicator of code indicating that you are on multiline expression. For Example,

>var func = function(a,b) {
... var x = a + b;
... return x;
... };
undefined
>func(1,2);
3

This dots indicates that, its waiting for the braces to close out. If we do something like

>func(
... 4,
... 5);
9

Increaing level of dots means increasing level of nesting.

> var func = function(a,b) {
... var f = function(c,d) {
..... return c + d;
..... }
... return f(a,b);
...}
undefined
>func(5,6);
11
>

Please Like and Share the Blog, if you find it interesting and helpful.

No comments:

Post a Comment

Contact Us

Name

Email *

Message *

Sponsers

CC License