-
Notifications
You must be signed in to change notification settings - Fork 0
#4 π How to run JavaScript using NodeJS
*****************************Tutorial Start π₯ ********************************
Download Node.Js herehttps://nodejs.org/en/download/
Run and Test your javascript code on outside of browsers by using node.js on command shell or powershell both:
<script> // C:\Users\adarsh>node // Welcome to Node.js v14.7.0. // Type ".help" for more information. // > var x=45 // undefined // > var y=36 // undefined // > var sum=x+y // undefined // > // > console.log(sum) // 81 // undefined // > </script>
But the alert function are not run on command shell message show "uncaught type error: alert is not defined" because command shell are not showing windows.
- Type .help on command shell for more information what you can do on shell.
Run and Test your javascript code on outside of browsers by using node.js on command shell or poweshell both:
<script>
//going to execute javascript code using node.js
console.log("This is my file");
var x=55;
var y=65;
//concatenate method
//console.log("sum of x and y is " + (x + y));
//console.log("Thankyou for you time....!!!");
//output
// D:\JavaScript-Tutorial-Crash-Course>node lecture4.js
// This is my file
// sum of x and y is 120
// Thankyou for you time....!!!
</script>
*****************************Tutorial End π ********************************
FOllow me on Github