Question on Javascript
Question on Javascript
1. What are the differences between `var`, `let`, and `const` in JavaScript?
2. How does variable hoisting differ between `var`, `let`, and `const`?
3. When would you use `let` or `const` instead of `var`, and why?
4. Can you explain the concept of block-scoping with `let` and `const`?
1. Explain the difference between primitive data types and objects in JavaScript.
4. How can you convert a string to a number and vice versa in JavaScript?
5. How do you create an array in JavaScript, and what methods can you use to manipulate arrays?
4. Can you explain the concept of the "truthy" and "falsy" values in JavaScript control structures?
1. Explain the difference between the `forEach`, `map`, `filter`, and `reduce` methods in JavaScript
arrays.
3. What are prototypes in JavaScript, and how do they relate to object inheritance?
**Closures:**
**Callbacks:**
2. Can you explain the concept of callback hell and how to avoid it?
4. What are some common asynchronous operations where callback functions are used?
**Promises:**
4. How does the async/await syntax simplify asynchronous programming compared to Promises?
1. Explain the difference between synchronous and asynchronous JavaScript code execution.
3. What are some advantages of using Promises over callback functions for handling asynchronous
code?
4. How does the `async/await` syntax improve readability and maintainability of asynchronous code?
Constructor Functions:
Higher-Order Functions:
Anonymous Functions:
Function Declarations:
Function Expressions:
Arrow Functions:
1. What are arrow functions, and when were they introduced in JavaScript?
2. How do arrow functions differ syntactically from regular function expressions?
3. What is lexical scoping, and how does it apply to arrow functions?
4. Can you provide an example of using arrow functions in a practical scenario?
Anonymous Functions:
Callback Functions:
Selectors in DOM:
1. How do you select elements by ID, class, or tag name in the DOM?
2. What are the differences between querySelector() and getElementById()?
3. Explain the purpose of using CSS selectors in conjunction with JavaScript.
4. How do you select multiple elements using a single selector?
createElement:
appendChild: