Podcast
Questions and Answers
What is the purpose of the ‘class' attribute in HTML?
What is the purpose of the ‘class' attribute in HTML?
- To define the type of an element.
- To group elements for styling purposes. (correct)
- To specify the order of elements on the page.
- To uniquely identify an element.
Which of the following correctly defines the structure of an HTML document?
Which of the following correctly defines the structure of an HTML document?
- <header>, <body>, <footer> (correct)
- <title>, <body>, <footer>
- <head>, <body>, <html>
- <html>, <script>, <footer>
How does the ‘rgba(R, G, B, A)’ function work in CSS?
How does the ‘rgba(R, G, B, A)’ function work in CSS?
- It defines text alignment.
- It determines the size of text.
- It sets the background color of an element.
- It specifies the transparency level of a color. (correct)
What does the CSS declaration 'margin: 40px 100px 120px 80px;' specify?
What does the CSS declaration 'margin: 40px 100px 120px 80px;' specify?
Which statement about the class names in HTML is true?
Which statement about the class names in HTML is true?
Which property is used to prevent an element from being visible in CSS?
Which property is used to prevent an element from being visible in CSS?
What does a marquee in HTML do?
What does a marquee in HTML do?
Which option correctly represents the CSS display properties?
Which option correctly represents the CSS display properties?
What is the correct syntax for a CSS media query?
What is the correct syntax for a CSS media query?
Which statement accurately describes the difference between == and === in JavaScript?
Which statement accurately describes the difference between == and === in JavaScript?
What is the purpose of the 'next()' function in Express middleware?
What is the purpose of the 'next()' function in Express middleware?
What is the primary role of components in Angular?
What is the primary role of components in Angular?
What does Scope determine in JavaScript?
What does Scope determine in JavaScript?
Which Angular decorator is used to define a service that can be injected into components?
Which Angular decorator is used to define a service that can be injected into components?
Which of the following best defines middleware in Node.js?
Which of the following best defines middleware in Node.js?
How can you implement lazy loading in an Angular application?
How can you implement lazy loading in an Angular application?
Which of the following is not correct syntax for writing output in JavaScript?
Which of the following is not correct syntax for writing output in JavaScript?
Which command is used to create a new Angular project with SCSS as the stylesheet format?
Which command is used to create a new Angular project with SCSS as the stylesheet format?
What is the correct shorthand for setting a border to 4px, dotted, and red for the element?
What is the correct shorthand for setting a border to 4px, dotted, and red for the element?
What is the purpose of Angular Guards?
What is the purpose of Angular Guards?
Which method is used to create a server in Node.js?
Which method is used to create a server in Node.js?
Which directive in Angular allows conditionally rendering a template based on a boolean expression?
Which directive in Angular allows conditionally rendering a template based on a boolean expression?
What are async and await used for in JavaScript?
What are async and await used for in JavaScript?
What does the error 'Cannot read property 'x' of undefined' typically indicate?
What does the error 'Cannot read property 'x' of undefined' typically indicate?
In JavaScript, what will the result be when adding a number and a string, such as $5 + '8'$?
In JavaScript, what will the result be when adding a number and a string, such as $5 + '8'$?
What does DOM stand for in JavaScript?
What does DOM stand for in JavaScript?
Which of the following statements about asynchronous programming in Node.js is true?
Which of the following statements about asynchronous programming in Node.js is true?
What will be the output of the following JavaScript code? 'let x = 10; function test() { let x = 20; console.log(x); } test(); console.log(x);'
What will be the output of the following JavaScript code? 'let x = 10; function test() { let x = 20; console.log(x); } test(); console.log(x);'
What type of values are returned from callbacks in JavaScript?
What type of values are returned from callbacks in JavaScript?
In Angular, which feature allows communication between components?
In Angular, which feature allows communication between components?
Which statement accurately describes the use of package.json in Node.js?
Which statement accurately describes the use of package.json in Node.js?
What does the following code perform? 'try { throw "An error occurred"; } catch (e) { console.log(error); }'
What does the following code perform? 'try { throw "An error occurred"; } catch (e) { console.log(error); }'
Which of the following is NOT a legal variable name in JavaScript?
Which of the following is NOT a legal variable name in JavaScript?
What does the @Component decorator do in Angular?
What does the @Component decorator do in Angular?
In JavaScript, which of the following describes the data type of 'let x = 7.5'?
In JavaScript, which of the following describes the data type of 'let x = 7.5'?
What will the following code output? 'for (var i = 0; i < 3; i++) { setTimeout(() => console.log(i), 1000); }'
What will the following code output? 'for (var i = 0; i < 3; i++) { setTimeout(() => console.log(i), 1000); }'
What will be the output of the following code? let array = [ 2, 7, 8]; array = ; console.log(array.length);
What will be the output of the following code? let array = [ 2, 7, 8]; array = ; console.log(array.length);
What is the correct way to merge two objects in JavaScript?
What is the correct way to merge two objects in JavaScript?
What will be the output of the function when it is called? function test(){ console.log(x); var x = 10; } test();
What will be the output of the function when it is called? function test(){ console.log(x); var x = 10; } test();
What will be the output of the following code? let x = 1; if(true){ let x = 2; console.log(x); } console.log(x);
What will be the output of the following code? let x = 1; if(true){ let x = 2; console.log(x); } console.log(x);
What will be the output of the following code, and how does the makeCounter() function work? function makeCounter() { let count = 0; return { increment: function() { count++; return count; }, decrement: function() { count--; return count; }, getCount: function() { return count; } }; } const counter = makeCounter(); console.log(counter.increment()); console.log(counter.increment()); console.log(counter.getCount()); console.log(counter.decrement());
What will be the output of the following code, and how does the makeCounter() function work? function makeCounter() { let count = 0; return { increment: function() { count++; return count; }, decrement: function() { count--; return count; }, getCount: function() { return count; } }; } const counter = makeCounter(); console.log(counter.increment()); console.log(counter.increment()); console.log(counter.getCount()); console.log(counter.decrement());
What will be the output of the following code? for (var i = 0; i < 3; i++) { setTimeout(function() { console.log(i); }, 100); }
What will be the output of the following code? for (var i = 0; i < 3; i++) { setTimeout(function() { console.log(i); }, 100); }
What will the following code output? async function getData() { return await Promise.resolve('I made it!'); } const data = getData(); console.log(data);
What will the following code output? async function getData() { return await Promise.resolve('I made it!'); } const data = getData(); console.log(data);
Which of the following is a valid way to define an anonymous function?
Which of the following is a valid way to define an anonymous function?
How can you create an Immediately Invoked Function Expression (IIFE)?
How can you create an Immediately Invoked Function Expression (IIFE)?
What does the following code do? setTimeout(() => { console.log("Hello"); }, 0); console.log("World");
What does the following code do? setTimeout(() => { console.log("Hello"); }, 0); console.log("World");
Flashcards
Change Text Color in HTML
Change Text Color in HTML
The color
attribute is used to change the text color within an HTML element. You can use hexadecimal color codes (#FF0000 for red), color names (red), or RGB values (rgb(255, 0, 0)) to specify the desired color.
HTML Class Attribute
HTML Class Attribute
The class
attribute is used to group HTML elements together for styling purposes using CSS. Multiple elements can share the same class name, making it easier to apply styles to specific groups of elements.
Displaying a Table in HTML
Displaying a Table in HTML
The <table>
tag is used to display data in a tabular format within an HTML document. Inside the table tag, you use <tr>
for rows, <th>
for table headers, and <td>
for table cells to structure the data.
HTML Marquee
HTML Marquee
Signup and view all the flashcards
Essential HTML Document Parts
Essential HTML Document Parts
Signup and view all the flashcards
HTML Attribute Syntax
HTML Attribute Syntax
Signup and view all the flashcards
CSS Display Properties
CSS Display Properties
Signup and view all the flashcards
Alpha Value in rgba()
Alpha Value in rgba()
Signup and view all the flashcards
CSS Media Query Syntax
CSS Media Query Syntax
Signup and view all the flashcards
Background Color on Mouseover
Background Color on Mouseover
Signup and view all the flashcards
JavaScript Data Types
JavaScript Data Types
Signup and view all the flashcards
== vs. === in JavaScript
== vs. === in JavaScript
Signup and view all the flashcards
Scope in JavaScript
Scope in JavaScript
Signup and view all the flashcards
Callback Functions in JavaScript
Callback Functions in JavaScript
Signup and view all the flashcards
DOM in JavaScript
DOM in JavaScript
Signup and view all the flashcards
Async & Await in JavaScript
Async & Await in JavaScript
Signup and view all the flashcards
Arrow Functions in JavaScript
Arrow Functions in JavaScript
Signup and view all the flashcards
'var', 'let', and 'const' in JavaScript
'var', 'let', and 'const' in JavaScript
Signup and view all the flashcards
Node.js Single-Threaded & Event Loop
Node.js Single-Threaded & Event Loop
Signup and view all the flashcards
npm (Node Package Manager)
npm (Node Package Manager)
Signup and view all the flashcards
Middleware in Node.js
Middleware in Node.js
Signup and view all the flashcards
'package.json' in Node.js
'package.json' in Node.js
Signup and view all the flashcards
Child Processes in Node.js
Child Processes in Node.js
Signup and view all the flashcards
Master/Slave Clusters in Node.js
Master/Slave Clusters in Node.js
Signup and view all the flashcards
Array Length
Array Length
Signup and view all the flashcards
Merging Objects
Merging Objects
Signup and view all the flashcards
Variable Hoisting
Variable Hoisting
Signup and view all the flashcards
Block Scoping with let
Block Scoping with let
Signup and view all the flashcards
Closure in JavaScript
Closure in JavaScript
Signup and view all the flashcards
Asynchronous Behavior of setTimeout
Asynchronous Behavior of setTimeout
Signup and view all the flashcards
async/await
for Promises
async/await
for Promises
Signup and view all the flashcards
Anonymous Functions in JavaScript
Anonymous Functions in JavaScript
Signup and view all the flashcards
Immediately Invoked Function Expression (IIFE)
Immediately Invoked Function Expression (IIFE)
Signup and view all the flashcards
Event Loop and setTimeout
Event Loop and setTimeout
Signup and view all the flashcards
What is a component in Angular?
What is a component in Angular?
Signup and view all the flashcards
What is an Angular router?
What is an Angular router?
Signup and view all the flashcards
How can you pass data between components in Angular?
How can you pass data between components in Angular?
Signup and view all the flashcards
What is lazy loading in Angular?
What is lazy loading in Angular?
Signup and view all the flashcards
What are Angular lifecycle hooks?
What are Angular lifecycle hooks?
Signup and view all the flashcards
What are Angular Guards?
What are Angular Guards?
Signup and view all the flashcards
What is the purpose of the @Component
decorator in Angular?
What is the purpose of the @Component
decorator in Angular?
Signup and view all the flashcards
How do you apply a CSS class conditionally to an element in Angular?
How do you apply a CSS class conditionally to an element in Angular?
Signup and view all the flashcards
You encounter an error stating 'Cannot read property 'x' of undefined'. What is likely causing this issue?
You encounter an error stating 'Cannot read property 'x' of undefined'. What is likely causing this issue?
Signup and view all the flashcards
When debugging an Angular application, which tool can you use to inspect HTTP requests made by your application?
When debugging an Angular application, which tool can you use to inspect HTTP requests made by your application?
Signup and view all the flashcards
What does the error '404 Not Found' indicate when trying to access an API endpoint in your Angular application?
What does the error '404 Not Found' indicate when trying to access an API endpoint in your Angular application?
Signup and view all the flashcards
In Angular, how do you bind a property of a DOM element to a component property?
In Angular, how do you bind a property of a DOM element to a component property?
Signup and view all the flashcards
Which command would you use to create a new Angular project with SCSS as the stylesheet format?
Which command would you use to create a new Angular project with SCSS as the stylesheet format?
Signup and view all the flashcards
What does the @Injectable()
decorator do in Angular?
What does the @Injectable()
decorator do in Angular?
Signup and view all the flashcards
Which directive is used to conditionally include a template based on the value of an expression?
Which directive is used to conditionally include a template based on the value of an expression?
Signup and view all the flashcards
Study Notes
HTML
- Changing text color: Use the
color
attribute within the<span>
or similar HTML element. Example:<span style="color:red;">This text is red.</span>
. - Class attribute: Groups elements for styling. It's useful for applying the same style to multiple elements.
- Displaying tables: Use the
<table>
tag. Inside, use<tr>
(table row) and<td>
(table data) for individual entries. - Marquee: A
<marquee>
tag creates scrolling text or images. - Required HTML parts:
<html>
,<head>
,<body>
. - HTML attribute syntax: Use the form
attribute="value"
within an HTML element tag. Example:<img src="image.jpg" alt="description">
CSS
- CSS display properties:
block
,inline
,flex
,grid
,none
. - rgba alpha: The alpha (A) value in rgba(R, G, B, A) sets the transparency of the color.
- Margin shorthand property:
margin: top right bottom left;
sets top, right, bottom, and left margins respectively (in that order) - Text formatting:
font-family
,font-size
,color
,text-align
. - Hiding elements: Use
display: none;
orvisibility: hidden;
(they have different visual effects). - CSS overflow: Controls content clipping or scrolling.
- Media query syntax:
@media screen and (max-width: 800px) {}
(Note the@
). - Form submission link: Set
target="_blank"
on the link to open it in a new tab. - Border shorthand:
border: 4px dotted red;
sets border width, style, and color. - Hover effect on links:
a:hover { background-color: red; }
JavaScript
- Data types:
Number
,String
,Object
,Array
,Undefined
,Boolean
,Null
,Symbol
,BigInt
. ==
vs.===
:==
compares values only,===
compares both value and type.- Scope and scope chain: Scope defines variable accessibility, scope chain connects scopes.
- Callbacks: Functions passed as arguments to other functions.
- DOM (Document Object Model): A tree-like representation of HTML elements in JavaScript.
async
/await
:async
function returns a promise,await
suspends execution until the promise resolves.- Arrow functions: Functions defined using
=>
var
,let
,const
:var
has function scope,let
andconst
have block scope.let
andconst
are hoisted but have a different declaration order.- Output methods in JavaScript:
window.alert()
,console.log()
,document.write()
, andbody.html()
(usingdocument.body.innerHTML
) - Examples of invalid variable names: those starting with a hyphen or underscore (other than
$
are valid)
Node.js
- Node.js threading: Node.js is single-threaded; it uses multiple threads internally for I/O operations.
- npm: The Node Package Manager (npm) manages JavaScript libraries in Node.js.
- Middleware (Node.js): Functions that run during HTTP requests lifecycle.
- Event loop: The core of Node.js which handles non-blocking operations.
- package.json: Configuration file for project metadata, dependencies, and scripts.
- Child processes: Independent processes for handling tasks.
- Master/Slave clusters: A cluster setup where a master process distributes tasks.
- Server creation: Use
http.createServer()
. - Asynchronous programming: allows other operations to continue while waiting.
- Request body parsing middleware:
body-parser
- Express
next()
function: Passes control to next middleware function. - JWT parts: JWT has Header, Payload, and Signature.
- JWT storage: Secure in cookies (with
HttpOnly
andSecure
flags). - JWT library:
jsonwebtoken
.
Angular
- Angular features: MVC (Model-View-Controller) architecture, two-way data binding, dependency injection.
- Component: Smallest UI building block in Angular, with a template and logic.
- Angular router: Manages navigation.
- Data passing between components: Angular uses services,
@Input
, and@Output
decorators. - Lazy loading: Loads modules or components when necessary for performance.
- Angular lifecycle hooks: Methods executed at specific points in a component's lifecycle.
- Angular guards: Protect routes from unauthorized access.
@Component
decorator: Marks a class as an Angular component.- Conditional CSS classes: Use
[class]
. - Error "Cannot read property 'x' of undefined": Variable may be undeclared, uninitialized, or out of scope.
- HTTP requests inspection: Chrome DevTools Network tab.
- 404 error: Indicates incorrect API endpoint URL.
- Binding properties: Use square brackets:
[property]="value"
. - SCSS Angular creation: use
ng new my-app --style=scss
@Injectable()
decorator: Marks a class for dependency injection (used for services)- Conditional template inclusion:
*ngIf
,*ngSwitch
General JavaScript concepts (from the questions)
- Syntax errors: Check for correct function calls, variable naming, and data types (e.g., using
'string'
instead of"string"
for string literals) - Variable hoisting:
var
declarations are moved to the top of their scope,let
andconst
are not. try...catch
blocks: Thecatch
block needs an error variable (err
) for safe error handling, andconsole.log(error)
is incorrect; useconsole.log(err)
- Function scope vs block scope: Use
let
andconst
inside blocks for localized variables. - Incorrect
if
structure: Review boolean expressions in your conditionals. - Immutability (general): Reassignment of variables, for example,
let arr = [1, 2, 3]; arr = 42
will create issues.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge on essential HTML and CSS concepts with this quiz! From understanding the 'class' attribute to manipulating display properties, this quiz covers key topics that every web developer should know. Challenge yourself and see how well you can demonstrate your skills!