JavaScript Most Important Interview Questions

01. What are truthy and falsy values?

Truthy values: Any numbers value truthy others than 0 and any string values truthy other than an empty string.

Falsy values: Any variable values likes(false,empty string, 0, undefined, nul, NaN)called falsy valuse.

02. What is the difference between null and undefined?

Undefined: Unintentionally missing values. undefined is negative/falsy values. undefined is variable declared but not the value set and function explicitly not a return value or function call but not parameters pass, and any object property access but this property not in an object this called undefined. undefined means a variable has been declared but not defined yet.

Null: Intentionally missing values called a null. and null is an assigned value. It means nothing.

03. Javascript double equal (==) vs triple equal (===)?.

double equal (==): Used for comparing two variables, but it ignores the data type of the variable.

triple equal(===): Used for comparing two variables, but this operator also checks data type and compares two values.

04. What is hoisting?

Hoisting: Hoisting is any declaration variable moved to the top of the function. like (var variable).

05. What is block Scop?.

Block Scop: We know javascript ES works in the block scop System area. If we see {}(curly brackets), it is block scop in ES6.let const keywords allow developers to declare variables in the block scope, in not accessible out of scope.

06. What is the window?.

window: The window is a javascript works place running environment and javascript execution is a global variable. it anywhere accessible. Global variables allow you to access data between collections,
requests, test scripts, and environments. Global variables
are available throughout a workspace.

07. What is “this” keyword?.

this keyword: “this” is a special keyword that allows you to access a certain object directly in the current scope, no matter where your current function is. By default, it refers to the global object. Js, it’ll be global and in Browser, it’ll be a window.

08. What is setTimeout() ?.

setTimeout: The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds. like: 1000 ms = 1 second.The function is only executed once.

09. JavsScript synchronous or asynchronous?.

synchronous: JavaScript is always synchronous and single-threaded. JavaScript is only asynchronous in the sense that it can make, for example, Ajax calls. The Ajax call will stop executing and others code executes able and the callback will run synchronously.

10. What is setInterval()?.

setInterval(): The setInterval() method repeats a given function at every given time interval. function call again and again.

like.setInterval(function, milliseconds);.

11. ArrayMax.

12. Remove duplicate items from an array..

13. Count the number of words in a string..

14. Reverse a string.

15. Calculate the Factorial of a number using for loop.

16. Calculate Factorial in a Recursive function.

17.Create a Fibonacci Series using a for a loop.

18. Create the Fibonacci series in a recursive way.

19.Prime Number or not.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store