A few of its applications are:
- It is used to create interactive websites.
- It helps in client-side validation.
- You can create dynamic drop-down menus.
- Features like display of date, time and clocks can be used.
- Displaying popup windows and dialog boxes (like an alert dialog box, confirm dialog box and prompt dialog box) can highlight your website.
Just like HTML, JS also uses angular brackets (“<>”) for scripting code which are called tags, mentioned in the example:
The script tag in the above example takes two important attributes:
Taking into consideration the script tag, let’s see a conventional code for Hello World in JS. It will give you a gist of the syntax.
Its output will be:
Breaking down this code, we can see:
- The <script> tag as discussed earlier id to specify the language and type used for the webpage
- Now our main code resides in this function “write” which is called to write a string into our HTML document. This function can be used to write text, HTML, or both.
In Conclusion, We hope this article was of some help to you and it attracted you to begin your expedition in JS scripting and develop your dream website.
READ MORE: 5 Programming Languages for Beginners
If you like our article, please subscribe to BsyBeeDesign for the latest updates on design. If we forget anything, share your creative ideas in the comments section.