JavaScript Interview Questions

Q1. What is JavaScript?

JavaScript is a lightweight, interpreted programming language used both on the client-side and server-side with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages. The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers.

Q2. What are the data types supported by JavaScript?

The data types supported by JavaScript are:

  1. Null
  2. Object
  3. Boolean
  4. Undefined
  5. Number
  6. String
  7. Symbol

Q3. Is JavaScript a case-sensitive language?

Yes, JavaScript is a case sensitive language. This means that the language , variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.


<!DOCTYPE html>



      <h3>Student Marks</h3>

      <p id=”Example”></p>


          var Marks, marks;

          Marks = 79;

          marks = 77;

          document.getElementById(“Example”).innerHTML = Marks;




Q4 What are the features of JavaScript?

Following are the features of JavaScript

  1. JavaScript is a lightweight, interpreted programming language.
  2. It is an open and cross-platform scripting language.
  3. It is designed for creating network-centric applications.
  4. It is complementary to and integrated with Java.

Q5 How can you create an Array in JavaScript?

<script language=”javascript”>

var array = [];

var arrays = [1, 2, 3];


Q6 How can you create an object in JavaScript?

<script language=”javascript”>

var student = {

    name: “Deepak”,

    class : 4,

    marks: 88



Q7. What is the use of isNaN function?

isNan is used for check number value. it returns true if the argument is not a number; otherwise, it return false.

Q8 How to  break JavaScript Code into next line?

In javascript  using a backslash, ‘\,’ we can break string statement


<script language=”javascript”>

document. Write (“Example line break \a in javascript,”);


Q9. What is timers in JavaScript?

Timers are used to execute a piece of code at a set time . In javascript usingsetTimeout, setInterval, and clearInterval we can do .

ThesetTimeout(function, delay) function is used to start a timer that calls a particular function after the mentioned delay.

setInterval(function, delay) function repeatedly executes the given function in the mentioned delay.

clearInterval(id) function instructs the timer to stop.

10. How to use comments in JavaScript?

<script language=”javascript”>

// Commnet for Single line


Commnet for





Leave a Reply

Your email address will not be published. Required fields are marked *