Frequently asked javascript questions

Samairasama
3 min readMay 8, 2021

--

There are given some javascript frequently asked questions below. these questions are frequently asked in the interview.

  1. what are the difference between double equal(==) and triple equal(===)?

Answer: both operators are used for comparing values. double equal compares only values, it does not care about data types. but triple equal compares data types with the values.

2.What are truth and falsy values?

Answer: if we declare a number variable and we are checking the value is true or false javascript thinks it is true. if the value of the variable is undefined javascript assumes it as undefined. in number variable, if we assign the value 0 javascript assumes it as false. and in the string variable, if we assign an empty string, javascript assumes it as false also.

3. Difference between undefined and null.

Answer: The undefined property indicates that a variable has not been assigned a value, or not declared at all. if a function is not explicitly returned then it will show the value as undefined. if the user wants to read an undeclared property of an object then the value will be undefined because it does not exist. undefined is negative or false. In javascript null is “nothing”.it is supposed to something that does not exist. null has been explicitly set if any declared variable does not have any value or it had some value initially but is absent at that time.

4.What is scope in js?

Answer: Scope determines the accessibility of variables.if something is declared inside a function that will be only accessible inside the function.it will not exist outside the function. there are two types of scopes. one is the local scope and the other is the global scope. the variable which is declared outside the function will be accessible inside the function and outside the function both.

5.what is closure in javascript?

Answer: If we call a function or return a function from another function then it will create a closed environment. they keep external variables as references. global can be made local with closures.

6.what is a window in javascript?

Answer: the window represents the browser window. all global variables, function. javascript object becomes the members of the window object. global become properties of the window object and function becomes the method of the window object.

7.what is javascript?

Answer: javascript is a scripted language that is light weighted, interpreted but just in time compiled.it has some first-class functions. it's a client-side language but can be used in server-side with the help of node.

8.what are the key features of javascript?

Answer: There are some key features of javascript. these are-

a.its a single-threaded language.

b.it can validate user input

c.it is a platform-independent language.

d.it has date time feature.

e.It can detect the user browser and os

9.what is DOM?

Answer: DOM stands for document object model. the DOM defines for accessing documents. we can access full HTML or part of an HTML form javascript with the help of DOM. The HTML DOM is a standard object model and programming interface for HTML

10.what is an API?

Answer: API stands for application programming interface. all browser has a set of built-in API's to support complex functionalities. we can access API data using get and post.

Hope you have enjoyed reading this article and found this article helpful.if you have enjoyed this then follow me on LinkedIn.

--

--

Samairasama
Samairasama

No responses yet