JavaScript: Javascript is a client side scripting language which is directly execute on client browser. The main benefit of using javascript is that it's reduce the server side traffic. Normally javascript is used for validation purpose because it's provide a secure validation code. All modern HTML pages are using JavaScript to add functionality, validate input, communicate with web servers, and much more.
You can working with javascript as a two form of method.
1. Inline javascript
2. Internal javascript
1. Inline javascript: The javascript is declare inside of body part without creating a function. Which is call directly when form is loaded.
ex:
<!DOCTYPE html>
<html>
<head>
<title>Inline Javascript</title>
</head>
<body>
<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>
<script>
function Message()
{
document.write("hello world.....!!");
}
</body>
</html>
2. Internal JavaScript: Internal javascript is always called by function which function is created inside of head part.
ex:
<!DOCTYPE html>
<html>
<head>
<title>Internal Javascript</title>
<script>
function Message()
{
document.wite("hello world....!!!");
}
</script>
</head>
<body>
<h1>My First JavaScript</h1>
<p id="demo">This is a paragraph.</p>
<button type="button" onclick="Message()">Message</button>
</body>
</html>