Javascript
Javascript
INTRODUCTION TO JAVASCRIPT
• What is JavaScript?
• It is designed to add interactivity to HTML pages.
• It is a scripting language (a light weight programming language)
• It is an interpreted language (it executes without preliminary compilation)
• Usually embedded directly into HTML pages
• And , Java and Javascript are different
WHAT CAN A JAVASCRIPT DO?
• Internal JS: We can add JavaScript directly to our HTML file by writing the code inside
the <script> tag.
• The <script> tag can either be placed inside the <head> or the <body> tag according to the
requirement.
• External JS: We can write JavaScript code in another files having an extension.js and then
link this file inside the <head> tag of the HTML file in which we want to add this code.
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Basic Example to Describe JavaScript
</title>
</head>
<body>
</html>
JAVASCRIPT SYNTAX
• JavaScript Syntax is used to define the set of rules to construct a JavaScript program
• console.log(num1)
• console.log(num2)
• console.log(str1)
• console.log(str2