WHAT IS JAVASCRIPT AND HOW DOES IT WORK?

Published: 2020-02-05 09:35:19

JavaScript is a simple programming or scripting language which is very light weight. JavaScript code is written in the HTML page also it is used to enhance HTML pages, it is mainly used in Creating websites and web applications, JavaScript is a high level interpreted programming language. It is an open source programming language, and anyone can use it.

It is also a client-side language, you can use JavaScript in HTML pages with two ways, First you have to paste all JavaScript code in HTML code the second way you can create a separate JavaScript file, JavaScript is a scripting language for determine HTML elements, like Boxes, form, images, paragraphs and such, and for determine a few non HTML objects like the browser. the 1st time Developed by Brendan Eich and originally known as LiveScript, the programming language JavaScript was renamed in 1995.


ADVANTAGES OF JAVASCRIPT
Faster Speed:  Client side JavaScript is very fast because it can be run instantly within the client side browser.

Easy for leaning: JavaScript is comparatively simple to learn and use

Most accessible language in the World tool chain installed on almost 100% of computer in the world.

Increased interactivity: You can create interfaces that react on the user interactions.

Richer interfaces: you can use JavaScript to include such items as drag & drop components and sliders to give a rich interface to your site visitors.

Less server interaction: use input can be validated before sending the page off to the server. This saves server traffic, which means less load on server.

Server Load: JavaScript cannot read from or write to the hard drive or another storage device connected to the computer.
          
DISADVANTAGES OF JAVASCRIPT
      It takes a lot of time to create anything that even resembles a webpage.


     It isn’t as flexible as other webpage developers like Dreamweaver.


     It is not centralized, all the WebPages must be edited separately.


     A prototype is a value (number, string, function, etc) that you can assign to all instances of a class       using Class Name. Prototype.


 Instead of each instance having a copy of the member, the single prototype member is shared


 This gives you substantial memory savings if you have many instances of the object


HOW IT WORKS

It is embedded right into the HTML of a page between <script> tags. Or, an external JS file can be linked, which is helpful if multiple pages are sharing the same lump of code.
Example of JavaScript


javascript-tutorial


BELOW IS AN EXAMPLE OF A BASIC JAVASCRIPT FUNCTION.

·         Load an external JavaScript file into a web page as follows:
·         <script type="text/javascript" src="/path/to/javascript/katutorial.js"></script>
·         You can specify the complete URL if the javascript is from a different domain from the web page as follows:
·         <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
·         JavaScript can be directly embedded in the HTML. The following causes the web page to popup an alert box when it is loaded.
·         <script type="text/javascript">
·         alert("Page is loaded");
</script>

https://www.katutorial.com/2019/11/what-is-javascript-and-how-does-it-work.html