So my task is this
Write a JavaScript program numbers1to10.js that prints on the console the numbers from 1 to 10 (each at a separate line). Run the program through Node.js. Example:
Command: node numbers1to10.js
Output: 1 2 3 4 5 6 7 8 9 10
I wrote the .js file called numbers1to10.js
function print1to10() {
for (var i = 1; i < 11; i++) {
console.log(i);
}}
But i cant seem to open i trought nod.js
What do i have to do?
You don't call your function
Try:
function print1to10() {
for (var i = 1; i < 11; i++) {
console.log(i);
}}
print1to10();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.