Refering to the homepage and the documentation, I installed node.js, created example.js and ran the script. But I got 3 dots (...) and nothing else. Where should I look?
> node example.js
...
Running this on Windows 7 x64
(three dots in JavaScript) is called the Spread Syntax or Spread Operator. This allows an iterable such as an array expression or string to be expanded or an object expression to be expanded wherever placed. This is not specific to React. It is a JavaScript operator.
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.
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];
The HTML entity … generates the glyph called a horizontal ellipsis. This is what typographers use … to represent three dots ( when they mean something is omitted ). – O.
It appears that you have run node.exe
, which opens a terminal, and have typed node example.js
into that terminal.
So basically, you opened node
in an interactive terminal, and then typed node example.js
, so it is trying to run that as if it were JavaScript. It shows the three dots because that is not valid JavaScript code, and it is waiting for you to type more code that might make it valid.
You should be running node.exe example.js
from a cmd
prompt, where you'd see a prompt more like C:\>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With