First Program In JavaScript

avatar

image.png

Image Source

Well everyone's programming journey starts with their first "Hello World" program. It has now been a convention for your first step in programming career and it is used to understand the basic syntax and flow of the program. It was first written by Brian Kernighan, also known as the author of C programming language and now it has been a tradition. Well, my journey to JavaScript starts with the same simple program. To start JavaScript you don't need to install anything really. You just need a text editor and browser to understand the simple concept of it and every computer now comes with simple text editor software (Notepad) and browser. I like to learn it in a fun way saving my time and effort so I decided to go with Visual Studio Code that has become very popular in recent years for web development due to its light-weight features.

image.png

Here's a simple code. You just need a basic HTML5 template. Obviously, you can use JavaScript anywhere in your document. I had tried using it just after <title> tag. Here's my output:

image.png

Another way you can do is use alert() function that displays a box over your current browser window with the message you passed in the parenthesis.

image.png

I downloaded HTML5 Boilerplate Template extension and Live Server extension from the VS Code. It is recommended for beginners as it saves much of time for you. JavaScript is supported by many modern browser including Microsoft Edge, Safari, Opera, Chrome and so on.



0
0
0.000
0 comments