Eupheus
medtigo Interview Questions and Answers
Q1. Difference between let, var, and const keyword
let, var, and const are JavaScript keywords used for declaring variables with different scopes and mutability.
var is function-scoped and can be redeclared and reassigned
let is block-scoped and can be reassigned but not redeclared
const is block-scoped and cannot be reassigned or redeclared
Use const for values that won't change, let for values that will, and var for legacy code or global variables
Q2. Explain the use of the $ sign in JQuery
The $ sign in JQuery is a shorthand for the JQuery function.
The $ sign is used to select elements in JQuery.
It can also be used to create new elements.
It is a shorthand for the JQuery function.
Example: $('p') selects all the paragraphs on a page.
Q3. What is hoisting in javascript
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope.
Variables declared with var are hoisted to the top of their scope
Function declarations are also hoisted to the top of their scope
Function expressions are not hoisted
Hoisting can lead to unexpected behavior and bugs
Example: console.log(x); var x = 5; // Output: undefined
Q4. Rate yourself in Javascript and JQurey
I rate myself 8/10 in Javascript and 7/10 in jQuery.
Proficient in using vanilla Javascript to create dynamic and interactive web pages
Experience in using jQuery to simplify DOM manipulation and event handling
Familiarity with popular Javascript frameworks like React and Angular
Continuously learning and improving my skills in Javascript and jQuery
Q5. Explain async, await, and promises
Async, await, and promises are JavaScript features used for handling asynchronous operations.
Promises are objects that represent the eventual completion or failure of an asynchronous operation.
Async/await is a syntax for writing asynchronous code that looks like synchronous code.
Async functions always return a promise.
Await can only be used inside an async function and it waits for the promise to resolve or reject before continuing execution.
Async/await is built on top of pro...read more
Q6. Difference between == and ===
The difference between == and === is that == compares values while === compares both values and types.
The == operator performs type coercion before comparing values.
The === operator does not perform type coercion and compares both values and types.
Using === is generally considered safer and more reliable.
Example: 5 == '5' returns true, but 5 === '5' returns false.
Q7. Explain callback hell
Callback hell is a situation where multiple nested callbacks make the code difficult to read and maintain.
It occurs when callbacks are nested within other callbacks.
It can lead to code that is difficult to read and maintain.
It can be avoided by using promises or async/await.
Example: fs.readFile('file.txt', function(err, data) { fs.writeFile('file2.txt', data, function(err) { console.log('File written!'); }); });
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month