19 Tweets 4 reads Mar 29, 2023
Top 100 JavaScript Interview Questions and Answers in 2023:
Thread [Part 3]:
Here's part 1 of this JS Interview Questions threads series:
Here's part 2 of this JS Interview Questions threads series:
Part 3 starts here:
Q21. What is NaN in JavaScript?
NaN is an abbreviation for β€œNot a Number.” It represents a value that is not a valid number in JavaScript.
Q22. What is debouncing in JavaScript?
The debouncing technique prevents a function from being called again until a particular time has passed since the last call.
Its primary application is in Web application search functionality. The API is called only once per user input.
Q23. How to get the type of a variable?
To know the type of a JavaScript variable, we can use the typeof operator.
Q24. Explain the call(), apply(), and bind() methods.
The call() method invokes a function with the specified context and parameters.
The apply() method invokes a function with the context specified and the arguments provided as an array (or an array-like object).
It is similar to call(), except that it accepts parameters in the form of an array.
The bind() method generates a new function that, when called, has this keyword set to the specified context, with a sequence of arguments preceding it.
It’s similar to call(), except instead of calling the function directly, it returns a copy of the new function.
Q25. What are the three types of JavaScript errors?
Syntax Error: The syntax of the program is not correct.
Reference Error: The JavaScript Engine cannot find a reference to a variable or function in memory.
Type Error: Trying to reassign a const variable will lead to a Type Error.
Q26. What is the use of this keyword in JavaScript?
In JavaScript, the this keyword points to the object currently referred.
The this keyword is widely used to assign values to object attributes in constructors.
Q27. What is the difference between async and defer?
In async, while parsing HTML, the browser fetches the script from the network asynchronously if we encounter a script.
After fetching the script, the browser stops parsing HTML and executes the script.
After executing the script, the browser resumes the HTML parsing.
In defer, while parsing HTML, the browser fetches the script from the network asynchronously if we encounter a script. The browser executes the scripts only after parsing the HTML.
Q28. What are cookies?
Cookies are small data packets that the server sends to the client.
The client stores the cookie inside the browser and sends it to the server on each future request.
Q29. What is the difference between let and var keywords?
Both let and const are used for declaring a variable in JavaScript.
The var keyword variables have function scope, while the let keyword variables have block scope.
Q30. What is the difference between let and const keywords?
In JavaScript, both let and const are used to declare a new variable.
The main distinction is that variables declared with the const keyword cannot be reassigned.
That's a wrap!
If you enjoyed this thread:
1. Follow us @codedamncom for more of these.
2. Retweet the first tweet above to share with your friends.

Loading suggestions...