Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js spits out nothing but three dots [duplicate]

Tags:

node.js

I installed node.js on Windows machine and opened command prompt. When I tried "Hello World" examples the only output I'm getting is three dots:

node hello.js
...

Am I doing anything wrong?

like image 367
user3348282 Avatar asked Feb 24 '14 20:02

user3348282


People also ask

What does three dots mean in Nodejs?

The three dots in JavaScript are the spread / rest operator. Spread operator. The spread syntax allows an expression to be expanded in places where multiple arguments are expected.

What does 3 dots mean in JS?

Rest operator. When used within the signature of a function, where the function's arguments should be, either replacing the arguments completely or alongside the function's arguments, the three dots are also called the rest operator.

What do three dots above and below code mean?

When we see three dots (…) in the code, it's either rest parameters or the spread operator. There's an easy way to distinguish between them: When three dots (…) is at the end of function parameters, it's "rest parameters" and gathers the rest of the list of arguments into an array.

What does 3 dots mean in Typescript?

The three dots are known as the spread operator from Typescript (also from ES7). The spread operator return all elements of an array. Like you would write each element separately: let myArr = [1, 2, 3]; return [1, 2, 3]; //is the same as: return [...myArr];


1 Answers

"node hello.js" is not valid javascript, so node repl ( Read-Evaluate-Print Loop ) assumes that error is because you are entering multi line javascript and indicates this with '...'. To exit multi line mode just enter '.' command.

As mentioned in first comment, this is common confusion (starting node.exe and entering 'node hello.js' in repl) - read linked answer first.

like image 80
Andrey Sidorov Avatar answered Sep 22 '22 23:09

Andrey Sidorov