Introduction to JavaScript

Introduction to JavaScript
Techiio-author
Written by Sagar RabidasFebruary 19, 2022
10 min read
JavaScript
3 VIEWS 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 3 VIEWS SHARE
Techiio-author
Sagar Rabidas

Software Developer

Today start the discussion with JavaScript

About JavaScript:-

On this topic, we have mentioned the advent of javascript as it is a lightweight dynamic programming language. Applications written in this language are referred to as scripts, those scripts are embedded in net pages, and they can manipulate the HTML content. Those scripts execute as web pages are loaded; javascript’s do no longer need to have complied to execute. Previously javascript turned into referred to as LiveScript, but later it turned into changed to JavaScript.

As java changed into very popular at that point and introducing a new language with the similarity in names could be a useful, notion. However later, javascript became an impartial language with its specification referred to as ECMA Script. Netscape 2.0 is the first in which the implementation of javascript turned into first seen. The syntax of javascript is more encouraged through the programming language ‘C.’

Execution of JavaScript:-

Javascript is a scripting language, it can't execute on its own, so we need a platform to execute it. This platform is nothing however the browser wherein we open the internet page; browsers already have integrated execution engines. In advance instances, it turned into supported especially by using ie(internet explorer), so for lots websites, there was a notice for better performance using IE7 or so. But nowadays, all browsers help javascript, so we don’t need to bother whether or not our website will function properly for all browsers or it'll be supported using any particular browser only. The scripts may be achieved with the assistance of the javascript engine; the presence of these engines assures the execution of scripts inside the browser, server, or some other device.

The name for the engines differ as a browser; some browser embedded engines are called “JavaScript Virtual Machine,” while a few others are listed below:

  • V8 is Google Chrome’s open-source JavaScript engine developed by Chromium Project.
  • SpiderMonkey is the first engine developed by Netscape Communications.
  • Nashorn, JScript, Rhino, etc. Are few other JavaScript engines.

Client-Side JavaScript:-

The maximum common shape of language is purchaser-side javascript. Browsers need to interpret the scripts; for that, it needs to be covered or pointed via the HTML report. Javascript’s included within the HTML; for this, HTML doesn't want to be static. However adding scripts, we can make a more interactive webpage.

Customer-side scripts offer advantages over conventional server-side scripts, e.G. We implement javascript to validate basic records stuffed on the website which include age for numbers, electronic mail for @, and.Com, and so on. The scripts developed and embedded for validation, are accomplished once the user submits the shape and if the entries are legitimate shape can be submitted else an errors message will pop up.

Features of Client-Side JavaScript

Given below are the features of client-side JavaScript:

  • We can Control Document Appearance and Content.
  • We can Control the Browser like pop-up boxes.
  • Interact with HTML Forms e.g. we can have to submit button.
  • Interact with the User e.g. we display messages on a particular text or word.

Why JavaScript is Unique:-

There are numerous tools and programming languages available for the creation of web browsers. Javascript is one of a kind from any of them because of the presence of three capabilities that are uniquely combined. The incorporation of those 3 features collectively is made available handiest in javascript and this makes it a unique programming language, especially for interface design.

  • It provides complete integration with HTML. HTML is a standard tool for the development of web pages. Assimilation of JavaScript brings in powerful libraries and tools to handle most of the required tasks.
  • Along with being integrated with HTML, it also is supported by all browsers which makes it the ultimate choice.
  • The programming language is efficient with constantly evolving libraries. This makes JavaScript a high-performing programming language in all areas of web, mobile app developments, and even IoT.

Examples of Javascript:-

Given below are the examples of JavaScript:

Example #1

Embedded Script.

We must keep all our javascript code within <script>…..</script> tags, if we're including our code in HTML record. This will distinguish our code from the relaxation of the code. There are many client-facet scripting languages available, it is recommended to specify the scripting language. To accomplish that we just need to add a type attribute within the <script> tag as follows: <script type=“text/javascript”>

Now we will see the example where we have embedded “Hello World!” in the JavaScript as follows:

Code:

<html>
<head>
<title>My First JavaScript code!!!</title>
<script type="text/javascript">
alert("Hello World!");
</script>
</head&gt;
<body>
</body>
</html>

Example #2

External Script.

From time to time we may also want an unmarried javascript to execute on many different pages, without having to put in writing the same script on each web page. To enforce this, we can write javascript in an external report. After writing we must store the outside script with a selected.Js extension. The external script have to no longer have <script> or </script> tags. We can make use of this script by pointing to the .js file in the “src” attribute in the <script> tag as follows:

<script src=”javascript1.js”></script>

Below is the example of an external script, where we have used javascript1.js as an external file.

Code:

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

Advantages and Disadvantages of JavaScript:-

Given below are the advantages and disadvantages mentioned:

Advantages:

  • Validation of data can be done before sending it to the server. This saves traffic on the server which avoids unnecessary load on a server.
  • User-friendly web forms can be created, when users forget to fill or do some mistake they don’t have to wait for the webpage to reload and can be prompted then and there.
  • We can create interfaces that guide users when they hover over them via mouse.
  • Using JavaScript’s we can add drop-down a list, sliders, etc.
  • Date object of JavaScript’s eases working with dates and times.
  • Animation and roller-over images can be displayed.
  • The last modified date of the document can be timestamped using the Document object.

Disadvantages:

  • Client-Side JavaScript does not allow the reading and writing of files, as we cannot allow any random script to arrange our disk.
  • Networking applications are not supported by JavaScript.
  • Multi-tasking multi-threading is not supported by JavaScript.

HTML
CSS
JavaScript
3 VIEWS 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 3 VIEWS SHARE
Was this blog helpful?
techiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plan
You must be Logged in to comment
Code Block
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance