JavaScript – Introduction

What is JavaScript?

Javascript is a computer programming language used to make changes in Webpages.

Javascript is an object oriented scripting language that allows to interact with multiple webpages.

Javascript allows client-side script to interact with the user and make dynamic pages.

JavaScript code can be written into an HTML page and when a user requests an HTML page with JavaScript in it, the script is sent to the browser and the browser does something in the webpages.

What is a scripting language ?

A scripting language is also a programming language designed for integrating and communicating with other programming languages.

Some of the examples of these scripting languages are JavaScript, PHP, Python, and VBScript.

Since this is a scripting language we don’t have to compile the code. It runs as it is.

What is the client-side ?

The client side is also known as the frontend, that is the web-page displayed in the computer.

Usually ‘client side’ refers to everything in a web application that is displayed in front-end UI in any device.

Markup languages like HTML and CSS are interpreted by the browser on the client side.

Client-side processes are always written in JavaScript.

The client-side environment used to run scripts is usually done in a browser.

We don’t have to compile the javascript code for run the process.

What is the server-side ?

Usually ‘server side’ means everything that happens on the server in the back-end.

The server side process includes rendering dynamic web pages, interacting with databases, identity authentication, and push notifications.

In server-side language code, we have to compile and restart the server again to get the changes reflected.

Javascript interview questions and answers !!!

Click to Learn More about – Javascript online learning

Why do we learn JavaScript?

There are many reasons behind why we should learn javascript.

1. Simple to learn

JavaScript has a simple syntax and is an easy language to learn.

2. Runs inside the Browser.

JavaScript allows users to write code snippets and inject it in webpages and check functionalities.

Since JavaScript runs inside we can do all sorts of stuff in the browser without the pain of setting up environments and code editors, downloading compilers.

3. Most popular language.

JavaScript is a the most popular language in the world, because its very easy to learn.

4. Platform independent.

JavaScript is a platform independent language, It can run in all the platforms like Windows/Linux/MacOS.

5. Non Compatible language.

Since Javascript is a scripting language, the script runs automatically and we don’t have to compile the code and restart the servers.

6. In all Fields.

Javascript works in all fields and technology, some of them are listed below.

It works on the server with node js.

It works with Internet Of Things (IOT) devices.

It works with all the devices like mobile/notebook/desktop/laptop etc.

It works with cross platform desktop devices.

7.Game Development:

Javascript is used to develop games like shooting asteroids, snake games etc.

8.Design Visual Effects:

Javascript animation library enables the user to create proficient animated websites.

What is JavaScript syntax ?

JavaScript syntax is the set of rules or protocols that should be followed to achieve a javascript program.

Syntax :

1. Everything should be included inside <script></script> tag.

                        Javascript code begins here...

The <script></script> tag have two attributes.

Language :

language” attribute specifies what type of scripting language we are using.

Its value will be javascript.

Type :

The “type” attribute specifies the type of file and its value should be set as “text/javascript”.

So the syntax becomes

		<script language = "javascript" type = "text/javascript">
                        Javascript code begins here...

Become a Javascript full stack developer !!!

Click to Learn More about – Javascript online learning

What are the advantages of JavaScript ?

Advantages :

JavaScript is supported by most of the web browsers and platform in-dependant.

Server Load :

1. JavaScript code is only executed on the user’s computer processor/memory space and not directly on the web servers.
2. So, this saves bandwidth and load on the web server.

Simplicity :

1.JavaScript is an easy language to learn.

2.The syntax is very easy to understand.

Speed :

JavaScript is fast to the end user, hence provides greater user experience.

What are the dis-advantages of JavaScript ?

Disadvantages :

Security Issues :

1. JavaScript is explicitly added to web pages and client browsers, there is a chance that it can exploit user’s system.

2. Malicious code can also be executed on client machine.

3. We can disable JavaScript in the browser manually, so it will affect rendering the web-pages properly.

4. Buggy JavaScript code can crash or takes longer time to respond leads the browser stop responding.

Browser Support :

1. Some JavaScript features are browser dependent. There are many properties/methods in JavaScript which are implemented differently across browsers.

2. In JavaScript while getting DOM elements, different browsers gives different type of access to objects, specifically Internet Explorer.