Published: 2019-09-10   Views: 12
Author: Tanmeetwalia
Published in: Language
Javascript Interview Questions

Do you want to work as a Javascript Programmer ?

But the wide range of questions that are asked in a Javascript interview makes it hard for you to crack them.

So, how should one prepare for an interview?

EduThrill has got you covered! We curate updated interview questions on a gamified platform to help you

Learn, Analyse, and Test your skill for your interview

Here are some JAVASCRIPT INTERVIEW QUESTIONS

 

Q.1 What are the types of errors we encounter in Javascript ?

 

  • Logical Errors : These are the errors that occur due to execute wrong logic on a function which has a different operation to perform.
  • Run Time Errors : When wrong HTML commands are used, Run time error is enforced.
  • Load Time Errors: Errors which occur due to false syntax while loading a webpage. Also, the errors generated are dynamic.

Q.2 How can we redirect a page to another page in Javascript ?

 

1. Location.href : We can go back to access the original document in this way.

 

2. Location.replace : you cannot go back to access the original document in this approach as the original document’s url is removed when you click on the back button.

 

Q.3 Difference between Host objects and Native objects?

 

Host object : These objects are environment based and vary according to different environments. Example : Node.js have objects like node list whereas browsers include objects like windows.

 

Native Objects : Pre-defined objects in javascript are known as Native Objects. These objects work independent of the environment and hence also are called as Global objects.

 

Q.4 What is <This> in Javascript ?

 

<This> keyword refers to an object that is instantiated by the class in other Object-oriented programming languages but in Javascript ‘this’ is an object which ‘owns’ the corresponding method.

 

Q.5 Why do we wrap the content of the JS file into in Javascript?

 

Wrapping is done to provide a closure around the file’s content and creating a namespace which is private and helps in resolving name clashes among libraries and modules.

 

Q.6 Explain the two ways of creating a function. Also, what is function hoisting ?

 

Function Declaration : Functions with specified parameters.

 

Syntax : function name (parameterA, parameterB,….) 



Statement block 



2. Function Expression : When ‘function’ I used to define a function within a function. 

Syntax : const myfunc=function[NAME] 

(ParameterA,ParameterB…) 



[statements] 

}

 

Q.7 What is the difference between Anonymous and Named functions?

 

Var fun = function 

{ // anonymous function 

} ; 

Var y = function bar () 

{ // Named function assigned to variable y 

} ; 

Fun() ; // actual function execution 

Y() ;

 

Q.8 What does the term “Transpiling” denote?

 

Transpiling refers to the process of transforming + compiling. Basically you can convert your newer code into equivalents of the older code.

 

Q.9 How to check if a variable exists in Javascript or not

<html> 

<body> 

<script> 

Var b = 2; 

If (b != null ) {

 

Document.write (“Variable does exist”) } 

</script> 

</body> 

</html>

 

Q.10 What is “ Fat Arrow Function” in Javascript ?

We use this function to reduce the code and to avoid the use of the “function” keyword again and again

 

SYNTAX:

Var points = [25, 36, 89, 53] ; 

Var demo = points.map ( function ( val) { 

Return val + val ; 

} )

For more Interview Questions and answers on Javascript. You can play this Game on EduThrill App.

 

 

Author Bio

This user has not submitted a user bio yet

Disqus Comments

Articles Search

Sponsor

Social Media

Forum Threads Search

Pages Search