Web Technologies Flashcards
What is the purpose of HTML5’s <canvas> element?</canvas>
The <canvas> element provides a way to draw graphics, animations, and other visual content using JavaScript.</canvas>
Explain the box model in CSS.
The box model describes how elements are structured in terms of content, padding, border, and margin.
How can you include JavaScript in an HTML page?
You can include JavaScript using the
tag, either inline or by referencing an external file.
What is the difference between null and undefined in JavaScript?
null is a deliberate absence of value, while undefined signifies a variable that has been declared but hasn’t been assigned a value.
Explain CSS specificity.
CSS specificity determines which styles are applied when there are conflicting rules. It’s based on the combination of selectors used in the rule.
What is event delegation in JavaScript?
Event delegation is a technique where you attach an event handler to a parent element and let it handle events on its child elements, reducing memory consumption and improving performance.
What is a closure in JavaScript?
A closure is a function that captures variables from its containing lexical scope, allowing those variables to be accessed even after the outer function has finished executing.
Explain the concept of hoisting in JavaScript.
Hoisting is the behavior where variable and function declarations are moved to the top of their containing scope during the compilation phase.
How does CSS Flexbox work?
Flexbox is a layout model that allows you to design complex layouts with a more efficient and predictable arrangement of elements in a container.
What is the purpose of the localStorage and sessionStorage APIs in JavaScript?
These APIs allow you to store key-value pairs in the browser. localStorage stores data with no expiration, while sessionStorage stores data for the duration of a session.
What does AJAX stand for?
AJAX stands for “Asynchronous JavaScript and XML,” a set of techniques for making asynchronous requests to a server from a web page.
How do you create an AJAX request in JavaScript?
You can use the XMLHttpRequest object or the more modern fetch API to create AJAX requests.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate.
How do you parse JSON in JavaScript?
You can use the JSON.parse() method to convert a JSON string into a JavaScript object.
What is CORS, and why is it important?
CORS (Cross-Origin Resource Sharing) is a security feature implemented by browsers to prevent unauthorized requests from different origins. It ensures that requests are made only to trusted sources.
What is a single-page application (SPA)?
An SPA is a web application that dynamically updates content on a single web page, providing a more fluid and seamless user experience.
What is the virtual DOM in React?
The virtual DOM is a lightweight copy of the actual DOM in memory. React uses it to efficiently update the actual DOM by minimizing direct manipulations
Explain two-way data binding in Angular.
Two-way data binding automatically synchronizes data between the model and the view, so changes in the view are reflected in the model and vice versa.
What is a component in Vue.js?
In Vue.js, a component is a reusable and self-contained unit that encapsulates both the UI and its behavior.
What is the purpose of React Router?
React Router is a library that enables client-side routing in a React application, allowing you to create different “pages” within a single-page application.