Free Web Development Online Tutorials, Learn to Code
JavaScript basic interview questions for freshers, Advanced JavaScript interview questions

JavaScript basic interview questions for freshers

Latest JavaScript Interview Question Answer for Beginners.

javascript Interview Questions Answers

Advanced Javascript Interview Questions

  1. What is JavaScript?
    JavaScript is a client-side Programming language, but also can be used as server side scripting language, JavaScript can be used with all web development technologies like java,, php, python etc. JavaScript can post data to serve side and external API. JavaScript is an open source and cross-platform scripting language.
  2. Which company developed JavaScript?
    Netscape, a software company who developed JavaScript.
  3. What are the different Data Types in JavaScript?
    • String
    • Number
    • Boolean
    • Undefined
    • Null
    • Object
  4. What is 'this' keyword in JavaScript?
    'this' keyword refers the current object from where it was being called.
  5. What is the use of isNaN function?
    isNan function returns boolean value true if the argument is not a number otherwise it is false.
  6. How to comment any code in Javascript?
    Single line comment example
    // for Single line comment
    Multi line comment example
    /* Multi 
    comments */
  7. What are the different types of loops in JavaScript?
    • For loop
    • While loop
    • do-while loop
    Learn more about loop in javascript with examples
  8. Can we access JavaScript function written in a different file? If yes then how?
    Yes, we can add access JavaScript function written in a different file by adding the file reference.
    <script src="~/Scripts/jquery.validate.js"></script>
  9. Is JavaScript a case-sensitive language?
    Yes, JavaScript is a case sensitive scripting language. So when we define any variable (like var k;), while accessing we have to use the same case, otherwise it will be considered as a different variable
        var k;
        var K; // different ;
  10. What is the difference between "not defined" and "undefined" in JavaScript?
    When we try to use any variable that has not been declared or doesn't exist then JavaScript will throw an error var name is not defined.
    var a; // declaring x
    console.log(a); //output: undefined 

    Now if we try to user some variable that has not been declared before

    var a; // Declaration
    console.log(b);  // Output: ReferenceError: b is not defined
  11. How to create an object in JavaScript?
    There are many different ways we can create object in JavaScript, here is a common example
    var Employee = function (name, org, salary) { = name || "";  //attribute default value is null
        this.organization = org || ""; 
        this.salary = salary || 5000; 
    var emp1 = new Employee("Bill","Microsoft",3000);
    var emp2 = new Employee("Whitney","IBM",5000);
  12. How to declare an array with some default values in JavaScript?
    Usually we always declare any array with some values assigned in it, here is how we can do
        var colors =  ['red','blue','orange','while','black','green'];
    Learn more about JavaScript Array with example
  13. How to define anonymous function in JavaScript
    This type of function has no name, anonymous can be easily declared in like an expression, starts with function keyword.
    var helloWorld = function () {
        alert("Anonymous function invoked");
    Learn more about JavaScript Function with example
JavaScript Course Online, Check FREE JavaScript Tutorial
javascript course online
free javascript tutorial online