Javascript Interview Questions

What is JavaScript?


A high-level client-side scripting language that executes inside a browser. It enhances HTML in an order to make attractive web interface. It is better to control web page behavior along with javascript than with HTML alone.


Javascript development was started earlier in 1995 at Netscape Communications. Developers want to implement a new non-java language that supports in the navigator. At that time Java was very popular for web and they made JavaScript syntax similar to Java. JavaScript was officially released in June 1997.

Name and Version

The official name of JavaScript is ECMAScript. Initial name of JavaScript was Mocha but after some time it is renamed to JavaScript. It is called as ECMAScript after its standardization. European Computer Manufacturers Association often abbreviated as ECMA is an organization for ICT (Information Communication Technology). Latest version of JavaScript is ECMAScript 2017.

JavaScript and Java

JavaScript and java are two different language. Java is object-oriented, reliable and versatile language used for web and app development and on other hand JavaScript is client side scripting language that is a part of application which give some extra features.


The primary motive of JavaScript is to create attractive web pages that offer more user-friendly experience. This allows a page to validate data, create cookies, animation, 2D & 3D graphics, video player and much more. JavaScript, HTML and CSS are three pillars of web- development. Main purpose of JavaScript is to make a new language that will easily integrate with HTML page and run on browser.

How it works in web page

When you load a web page in browser HTML, CSS and JavaScript will be executed in browser environment. JavaScript is executed by JavaScript engine in browser. This JavaScript code modify HTML dynamically and CSS works on UI via DOM API.


It supports all browsers including Firefox, Chrome, Edge, Safari, etc. and doesn’t need to compile. It also runs on different types of OS like Linux, Windows, and Mac.

How it Compile

As a scripting language, it cannot run itself, in JavaScript browser is responsible to compile and run it. When a page is executed, a script is sent to browser and browser execute it.

Script Engine

Every browser contains a JavaScript engine to understand code. Browser includes various types of JavaScript engine.













As you know JavaScript is a client-side scripting language and most of the time it is used for front-end validation in a web page however it gives some tremendous features which are given below.

  •    It is a lightweight scripting language.
  •    Available open-source.
  •    Browser supportive.
  •    Integrated with Java or any other languages.
  •    Integrated with HTML.
  •    Case sensitive.
  •    Given more control to users on browser.
  •    Object-based language.


Since the usage of JavaScript is on client side, there have many security issues. Main security task in JavaScript is protecting client and server side information form hacking. There are two measures which make JavaScript risk to security. At first, we run every script separately so we can get only specific task and second, implement same origin policy that prevents script and give access to application data usage.

Security Vulnerabilities

A common JavaScript Vulnerabilities is Cross-site-scripting (XSS).  It enables hackers to manipulate data on a website. To prevent script from hacking,  use HTML escaping when you see unstructured data on websites. Another JavaScript Vulnerabilities is Cross-Site-Request-Forgery (CSRF). It enables hackers to control a user’s browser to take unintended movement on other websites.

JavaScript Frameworks

There are various JavaScript framework available on internet. Following framework are very popular among all developers.

  •    AngularJS
  •    Dojo
  •    jQuery
  •    Vue.js
  •    React
  •    Node.js
  •    Ember
  •    PhantomJS
  •    NightwatchJS

Editor and Compiler

You can write JavaScript code on notepad or various editors which is free to use and support your operating systems. Currently various types of JavaScript editors and javascript compilers and test automation framework are available online that can be used for functional testing. There are many advantages of online editors which are listed below.

  •    It doesn’t require any installation.
  •    Some editors comes up with Git support.
  •    Live preview option.


How to add Javascript in HTML page

JavaScript is added in HTML page just like CSS file. CSS uses <link> tag to add external style sheet and <style> tag to add internal style sheet, JavaScript only need <script> tag. You can add your JavaScript tag in HTML head section.
//JavaScript Code

Examples: -
A simple example of JavaScript with HTML 4
   <title>JavaScript code</title>
   <script type="text/javascript">
       alert("Hello JavaScript");

From HTML5 script type is not necessary to add in code.
 <title>JavaScript code In HTML5</title>
       alert("Hello JavaScript");

In JavaScript, you can add your code within  <script> tag.To manipulate HTML elements, JavaScript uses DOM method getElementById(). This method access element with specified id.

Example: -

<h1>My First Web Page</h1>
<p id="demo"></p>
<script type="text/javascript">

Summary: -   JavaScript is designed to run within HTML structure. If you want to write scripting code at client side then you can easily use JavaScript by adding it in a  ‘.js’ extension file and accessing it externally. Now JavaScript has become very popular language for software community and it is only limited to alerts and validations but also heavily used for DOM manipulation and animations.

Some of the manyJavascript Interview Questions listed below will help you get an idea about what questions gets asked in such jobs related to Software Engineering & Tech. Get through theJavascript Interview bar with our selectedJavascript Interview Questions for all Javascript enthusiasts!


For thousands of similar Javascript Interview Questions download EduThrill..

Experience the thrill of challenging people around the world on Javascript Interview Questions!