JavaScript Interview Questions

  1. Is JavaScript a case sensitive language?
  2. What is DOM?
    Acronym DOM stands for Document Object Model. A document object model represents the html document. It can be used to access and change the content of html.
  3. What is the difference between == and ===?
    The == operator checks equality only whereas === checks equality and data type i.e. value must be of same type.
  4. How can you update html content using JavaScript?
    Below is an example for same.

    Updated by JavaScript


  5. How do you create object in JavaScript?
    Below are few ways of creating object in JavaScript.
    a) var emp={id:100,name:”Jack,salary:700000}
    b) var emp=new Object();;”Jack”;
    c) function employee(id,name,salary){;;
    var emp =new employee(100,”Jack”,70000);
  6. How to create an array in JavaScript?
    Below are few ways of creating array in JavaScript.
    a) var myArr=[value1, value2, value3];
    b) var myArr= new Array();
    myArr[0] = “Jack”;
    myArr[1] = “Rockey”;
    c) var myArr = new Array(“Rockey”,”Jack”,”Maria”);
  7. What does the isNaN() function?
    Function isNan() returns true if the variable value is not a number.
  8. What is the difference between undefined value and null value?
    Undefined value: A value that is not defined is known as undefined value.
    Null value: A value that is defined by explicitly initialized by the keyword “null” is known as null value.
  9. How do you change mouse cursor using JavaScript?
    Below is the statement for same. = “wait”;  //sets wait cursor
  10. How do you change background color of html body using JavaScript?
  11. Write a function to open a web page in popup menu.
    function windowOpen() {
    var myWindow =‘’,’_blank’,’width=300,height=200, scrollbars=no,resizable=no’);
    return false;
  12. Does JavaScript supports function overloading?
    No, function overloading in JavaScript is not supported, if there are two methods with same name, latter one will be invoked.