Hello World! in JavaScript

      You can run javascript either on some Web Browser or in a node environment.

Note: We use .js extension for JavaScript files.


Let's create your first program in JavaScript:
     Create a JavaScript file as hello.js 
     Open the file in your favorite code editor and write-

                 console.log("Hello World")


Now if you have node installed in your system then run this file by using the command:

                  node hello.js

It will print "Hello World" on the console.


If you want to run this on the browser, go to your browser, right click>inspect>console, Paste the code and run, you'll a hello world on browser's console as well.


Continue Learning: Variables and Hoisting in JavaScript



Comments

Popular Posts