JavaScript interview questions, experience 0-3 years (2023)

JavaScript conceptual questions

In this blog we will see concept-based JavaScript interview questions & answers. We have another blog for Coding based JavaScript interview question

Questions (1 – 9) are based of candidates with 0-1 years of experience.

Questions (10 – last) are based of candidates with 1-3 years of experience.

So, let’s start:

1- What is JavaScript:

Answer: It’s a programming language which is used is used in most of the browsers now-a-day. It was developed by Brendan Eich, who was a Netscape programmer in 1995

2- Write a basic code in JavaScript.

Answer: console.log(‘hello’)

3- Where does JavaScript runs?

Answer: JavaScript is run in the Client (i.e. the browser). It also runs on Node server. Node.js runs on the V8 JavaScript Engine and executes JavaScript code outside a web browser

5- When does javaScript code runs/executes?

Answer: JavaScript scripts start running as soon as they are loaded, it also runs when it gets

events like click/mouse movements.

 6- How to make sure our javaScript  code runs only after Html/DOM is loaded


There are many ways:

a – document.onload = function…

b – window.onload = function…

c – <body onload=“script();”>

d – Use of defer keyword

<script src="deferMe.js" defer></script>
e. In jQuery, we use:
 $(document).ready(function() {

7 – Difference between document.ready and window.onload

Answer – document.ready is called when DOM gets loaded;

 window.onload is called when DOM + images + scripts files +css files gets loaded(if such files are referenced).

8- What is a call-back function?

Answer – When we want to perform any operation on completion of an event then that operation is called a callback function.

For example, we want to make call a method called ‘fire’ on click of a button(with id fireButton), then in this case ‘click’ is the event and ‘fire’ is our callback function.

    function fire() {
        // our logic



9 – Is JavaScript an object-oriented programming language?

Answer – No

10 – Is there any feature of Object-oriented programming language that JavaScript supports?

Answer – Yes, these are Object creation, class creation, Encapsulation, Polymorphism and Inheritance


11 – Give example of polymorphism in javaScript.

Answer – We will use (+) button to show how it behaves in different contexts.

console.log(2 + 5)                // output - 7
console.log("Hello: "+"John")     // output - Hello John

We can see that if inputs are integer, it adds them and if inputs are string, it concatenates them.

12 – How do we create a class in JavaScript ?

Answer – 

There are two ways to create a class.

1st – Traditional Way of Class using prototype:

function Person(first_name, last_name){
    this.first_name = first_name
    this.last_name = last_name
 prototype.display_full_name = function(){

    return `${this.first_name} ${this.last_name}`
const person1 = new Person("Alan", "Pal");
const person2 = new Person("Bob", "Page");
console.log(person1 .display_full_name()); 

Output -

Alan Pal

2nd way is ES6 way of defining classes, using the class keyword:

//Defining the class
class Person{
    constructor(first_name, last_name){
        this.first_name = first_name,
        this.last_name = last_name
    display_full_name = function(){
        return `${first_name} ${last_name}`
const person1 = new Person("Alan", "Pal");
const person2 = new Person("Bob", "Page");
Output -
Alan Pal

13 – What can be used in place of JavaScipt?

Answer: There are few other languages in which we can handle DOM and do other JS works, one mostly used language is TypeScript.


14 – What is the difference between TypeScript and JavaScript?

Answer – 

TypeScript (TS)

JavaScript (JS)

It is superset of JS

It is subset of TS

It supports OOPs pretty well

Limited support for OOPs. It is basically a prototype based language.

Its code can’t be natively interpreted by browsers. To work on browsers its code get converted into JS code, this process is called Transpilation.

Browser understands JS well.

Good for server-side technology

Limited use in server-side technology

Support interfaces

No support for interfaces

It supports strong typing, which means that type correctness can be checked at compile time. So, we get compilation errors at the time of development

No support for Type, so we don’t get compile time error due to Type

Class creation:
class Person {
  name: string;
  constructor(name: string) { = name;
Class creation:
class Person {
constructor(name) { name

15. What is asynchronous programming or asynchronous request?


Async request are used when we need to make a call to run separately when we don’t want our whole process to stop and wait for that particular call.

Its like creating a resource and using it until its work is done.

Example – It’s like while making tea/coffee you have gone to bring biscuits, so that you could have it with tea. Here tea and biscuits are running separately, you could first finish the tea to complete but no you did brought biscuits in the same time frame.

Sync request runs in sequence, its like complete task A then only going for next task B. 

16. What is a web API? 

Answer: It’s like a courier service which takes our data from our machine (client machine) to server machine and the reverse.

17. What is ES6?


Its short of ECMAScript, the 2015 version is the 6th version of the ECMAScript so its called ES6. 

Its the standardization of JavaScript, it has introduced several key features like let, const, arrow functions, template literals and many others.


18 – How to differentiate between array and an object in JS?


an array can be identified by the square brackets, eq – [1,2,3] and

objects can be identified by currly brackets, eq – {name : ‘bob’}

19 – What is JSON?, create a student object in JSON.


JSON stands for JavaScript Object Notation, it’s a text-based lightweight format to store and transfer data. It takes less space for storage and it’s to read by human.

An array of student objects looks like:

[{'name": 'Bob'}, {'name": 'Charles'}]

20 – passing a variable in ts vs js

21 – Data types in javascript.

22 – Difference between null and undefined.

Answer – Its best answered here – What is the difference between null and undefined in JavaScript? – Stack Overflow

23 – Difference between reference type and value type.

24 – What is a web API?

25 – What is a REST API?

Related Interview questions php/Javascript:

Leave a Reply

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