1️⃣ Q: What is the difference between id and class in HTML?
A:
-
id: Unique identifier for a single element.-
class: Can be used on multiple elements for styling or scripting.2️⃣ Q: What are media queries in CSS?
A: Media queries allow applying different styles based on device properties like screen width, height, orientation, etc. Used for responsive design.
3️⃣ Q: What is the difference between cookies, localStorage, and sessionStorage?
A:
-
Cookies: Sent with every request, limited size (~4KB).-
localStorage: Stores data with no expiration.-
sessionStorage: Clears when tab is closed.4️⃣ Q: What is the difference between inline, block, and inline-block elements?
A:
-
Inline: Flows with text, can’t set width/height.-
Block: Takes full width, starts on new line.-
Inline-block: Like inline but respects width/height.5️⃣ Q: How does event bubbling work in JavaScript?
A: Event bubbling means events propagate from the target element up to its parents, triggering any matching event listeners.
6️⃣ Q: What is a RESTful API?
A: A RESTful API follows REST principles, using standard HTTP methods and stateless communication to interact with resources (like JSON data).
7️⃣ Q: What is the difference between synchronous and asynchronous JavaScript?
A:
-
Synchronous: Code runs one line at a time, blocking the thread.-
Asynchronous: Allows non-blocking operations using callbacks, promises, or async/await.👍 Tap ❤️ for more!