This content originally appeared on DEV Community and was authored by angelo.miranda
It is important to be prepared prior to a job interview as you only have 1️⃣ chance to impress and convince the interviewers that you are the one they are looking for. Typically, you will meet up with different engineers who will ask very hard questions, and unfortunately, you will most likely not get the job ?? if one of them says 'NO' ? especially the senior ranking interviewer.
There would be a time for an engineer to look for a new role whether it is driven by a new challenge, more money, or to move to a different place.
In this case, it is vital to be completely ready and and know the common questions that are commonly asked so you are able to answer correctly and confidently. I have compiled the top 1️⃣0️⃣ Q&A for both Junior and Senior that is guaranteed to be asked on a job interview. I am in the process of writing/compiling HTML and CSS Q&A which I will post here when I get done.
Mid - Senior Level Questions and Answers
1. What is a closure?
- Closure is a function in a function. The inner function has access to the outer's function scope and parameters even after the outer function has returned.
2. What are the differences between call, apply, and bind?
- call and apply immediately calls a function while bind creates a new function that can be invoked in the future. Arguments with call are passed in one by one, separated with a comma while apply expects an array as its argument.
3. What is an event loop?
- An event loop is responsible for executing javascript code, collecting and processing events, and executing queued sub-tasks.
4. What is currying function?
A currying function is the process of taking a function with multiple arguments and turning it into a sequence of functions each with a single argument.
Curried functions are a great way to improve code reusability and functional composition
5. What is prototype in javascript?
- Prototypes are the mechanism by which JavaScript objects inherit from another object.
6. What is memoization?
- Memoization is an optimization technique by storing the result of expensive function calls and returning the cached results when the same inputs occur again.
7. What is a higher-order function?
a higher-order function is a function that accepts another function as an argument or returns a function as a return value or both of them.
Map, filter and reduce are some examples of higher-order functions that are already built-in to JavaScript.
8. What is event delegation?
- Event delegation is a pattern of adding a single event listener to a parent element instead of multiple elements.
9. Name some ways to handle asynchronous operation in javascript
Callback is a function that is used to notify the calling instance
Promise is an object representing the eventual completion or failure of an asynchronous operation. A pending promise can either be fulfilled with a value or rejected with a reason.
Callbacks are attached to the returned promises that make handling of asynchronous code easier and more readable.async/await is a new addition to ES2017 which is syntactic sugar on top of promises and make asynchronous code look synchronous code
10. What is recursion?
Recursion is a technique for iterating over an operation by having a function call itself repeatedly until it arrives at a result.
This is most effective for solving problems like sorting or traversing the nodes of complex or non-linear data structures
Don't feel like reading? Here is a video -
Entry - Junior Level Questions and Answers
1. What is Javascript?
- it is the scripting language of the web that was initially intended to run on the browser. Today, JavaScript is used in the server.
2. What is ECMAScript?
- is a standard specification for scripting languages. JavaScript is based on ECMAScript.
3. What is the difference between == and ===?
== compares values
=== compares both type and value
4. What is a promise?
- is an object that may produce a single value sometime in the future with either a resolved value or a reason for not being resolved
5. What is strict mode in JS?
- it is useful for writing secure JS code. It prevents some bugs from happening and throws more exceptions.
6. What is the difference between null and undefined?
null type is an object that is explicitly assigned to a variable.
undefined type is undefined where the variable has been declared but has no assigned value
7. What is AJAX?
- stands for Asynchronous JavaScript and XML. We can send data to the server and get data without refreshing the page.
8. Explain the difference between synchronous and asynchronous.
- Synchronous is blocking operation while asynchronous is not. Synchronous complete the current code before the next code is executed while asynchronous continue on the next code without completing the current code
9. What are the differences between var, let, and const
- var is scoped to a function. let and const are block-scoped. Accessible to nearest curly braces (function, if-else, for-loop)
10. What is the DOM?
- it stands for Document Object Model. This can be used to access and change the document structure, style, and content.
Don't feel like reading? Here is a video -
This content originally appeared on DEV Community and was authored by angelo.miranda
angelo.miranda | Sciencx (2021-04-18T04:54:06+00:00) Top 10 JavaScript Interview Questions and Answers you should know – Junior and Senior. Retrieved from https://www.scien.cx/2021/04/18/top-10-javascript-interview-questions-and-answers-you-should-know-junior-and-senior/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.