What is the difference between <div> and <section>?
Answer:
<div> is a generic container with no semantic meaning.
<section> represents a meaningful section of a webpage, usually with a heading.
What is hoisting in JavaScript?
Answer:
Hoisting is JavaScript's behavior where declarations are processed before code execution.
What is npm?
npm stands for Node Package Manager. It is used to install and manage packages/libraries for Node.js projects.
What is package.json?
Answer:
package.json contains important information about a Node.js project, such as:
What is middleware in Express?
Answer:
Middleware is a function that has access to the request, response, and the next middleware function.
next() passes control to the next middleware/route handler.
What is semantic HTML?
Answer:
Semantic HTML uses tags that clearly describe their meaning.
<header> , <nav> , <main>, <section>,<article>, <footer>
What is a closure?
Answer:
A closure occurs when a function remembers variables from its outer lexical scope even after the outer function has finished executing.
What is the difference between dependencies and devDependencies?
Answer:
- dependencies are packages needed by the application at runtime.
- devDependencies are generally needed during development, testing, or building.
What are indexes and why use them?
Answer :
Special data structures that store a subset of data to speed up queries and avoid full collection scans.
Why do we use Node.js?
Answer:
Node.js is commonly used to:
What is the difference between id and class?
Answer:
What is a Promise?
Answer:
A Promise represents the eventual completion or failure of an asynchronous operation.
pending , fulfilled , rejected
What is the difference between process.env and normal variables?
Answer :
process.env provides access to environment variables.
Environment variables are commonly used for configuration such as:
Why use Mongoose?
Answer :
Schema creation Validation Easy database operations
What happens if you don't call next() in middleware?
Answer:
The request will usually stop at that middleware and the client may keep waiting until a response is sent.
What is the purpose of the <meta name="viewport"> tag?
Answer:
It helps webpages display correctly on mobile devices.
What is the event loop?
Answer:
The event loop allows JavaScript to handle asynchronous operations while JavaScript itself executes code on a single main thread.
What is node_modules?
Answer:
node_modules is the folder where npm stores the packages installed in the project.
Difference between Schema and Model?
Answer :
Schema: Defines structure.
Model: Performs database operations.
What is the difference between app.use() and app.get()?
Answer:
app.use() is mainly used for middleware and can work with multiple HTTP methods.
What is an iframe?
Answer:
An <iframe> embeds another webpage or document inside the current webpage.
What is the difference between map(), filter(), and reduce()?
Answer
map() transforms every element:
filter() selects elements:
reduce() combines values:
What is res?
Answer:
The res (response) object represents the HTTP response that an Express app sends when it gets an HTTP request. It is used to send data back to the client, such as JSON data (res.json()), status codes (res.status()), or HTML pages (res.send()).
How do you find documents?
By using the db.collection.find() method.
What is req?
The req (request) object represents the HTTP request and contains properties for the request query string, parameters, body, HTTP headers, cookies, and other incoming data from the client.