What is JAVASCRIPT, How to add JAVASCRIPT ?

Posted by

JavaScript is object-oriented programming language which is used by several websites for scripting the webpages. It is an interpreted, full-fledged programming language that enables dynamic interactivity on websites when applied to an HTML document.

Features of javascript

  • All web browsers support JavaScript as they provide built-in execution environments.
  • JavaScript follows the syntax and structure of the C programming language.
  • It is a case-sensitive language.
  • JavaScript is supportable in several operating systems including, Windows, macOS, e
  • It provides good control to the users over the web browsers.

How to add Javascript?

There are two ways to add javascript in the file.

  • Inline way
  • external way

Inline way to add javascript

In this, we have two options – Head tag and Body tag or JavaScript can be added directly to the HTML file by writing the code inside the <script> tag . We can place the <script> tag  either inside <head> or the <body> tag  according to the need.

Syntax = <script type= "text/javascript"> </script>

External way to add javascript

in this also, we have two option to add our code in the file- Head tag and Body tag or The other way is to write JavaScript code in another file having a .js extension and then link the file inside the <head> or <body> tag of the HTML file in which we want to add this code.

syntax= <script src = "filename.js"  type =  "text/javascript"></script>
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x