what is javascript

Java script is lightweight, interpreted, web scripting programming language.
javascript is also called dynamic programming language which is used to create dynamic web pages.
javascript support object-oriented paradigms.

How to write javascript code?

To write javascript code we require one code editor and web browsers to run javascript code.

Code Editors

Web browsers

  • Google chrome
  • Microsoft edge
  • Mozilla firefox
  • Opera
  • UC Browser and many more

The first program in javascript

There are two way to write js code and run code

  • Using <script> tag
  • Using a file with .js extension

Using <script> tag:

<html>
<head>
<title>Js code using script tag</title>
</head>
<body>
<script>
console.log("welcome to javascript");
</script>
</body>
</html>

Using file with .js extension

document.write("Welcome to javascript");

save this file as first.js

create new html file with extension .html as first.html

<html>
<head>
<title></title>
</head>
<body>
<script src="first.js"></script>
</body>
</html>

Post written by: Hemant Singh
© 2020 - 2020 All rights are reserved