Javascript is used as client side scripting language.it adds interactive features to a web page. It is used for validate purpose.
There are two types of validation :
1. client side validation.
2. Server side validation
Client side is done at browser. For to limit the user age as 18 we can done at browser. But for example to check no of books available you have check database such this need server side validation.
To run java script different browsers use different engines. For example chrome use v8 and Mozilla use spider monkey engines
Now a day visual studio code is a popular editor for javascript.
The notes are below are taken from Wikipedia
A JavaScript engine is a computer program that executes JavaScript (JS) code. The first JavaScript engines were mere interpreters, but all relevant modern engines use just-in-time compilation for improved performance.
JavaScript engines are typically developed by web browser vendors, and every major browser has one. In a browser, the JavaScript engine runs in concert with the rendering engine via the Document Object Model.
The use of JavaScript engines is not limited to browsers. For example, the Chrome V8 engine is a core component of the popular Node.js and Deno runtime systems.
Since ECMAScriptt (ES) is the standardized specification of JavaScript, ECMAScript engine is another name for these engines.
Index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./script.js"></script>
</head>
<body>
<h1>welcome</h1>
</body>
</html>
Script .js
console.log("welcome to javascript code by karthikeyan and mukesh");
script is a keyword used to denote java script code. In index.html we mention that source file of script is script.js.
in the above program script,js and index.html are residing at same location.
Now a day Java script is used for server side validation also. We have to install node.js for that purpose.
To run the above program copy path of index.html in vs code editor.in browsers address bar simply paste it .
To see the result of console.log statement in browser press f12 short cut key.
Click console tab and see the results.
We can use node command to run the javascript program directly with out embedding with html program.
To get into terminal in vs code editior
Short cut key is ctrl+~
The ~ symbol is below esc key at keyboard.
To run script.js file just type the following line at terminal
Node script.js
-will continue
By Muthukarthikeyan
Contact :919629329142.
No comments:
Post a Comment