Podcast
Questions and Answers
Which of the following is the correct way to include JavaScript code directly within an HTML document?
Which of the following is the correct way to include JavaScript code directly within an HTML document?
- <javascript> // JavaScript code </javascript>
- <embed> // JavaScript code </embed>
- <js> // JavaScript code </js>
- <script> // JavaScript code </script> (correct)
Which of the following is NOT a component that a JavaScript statement may contain?
Which of the following is NOT a component that a JavaScript statement may contain?
- Paragraphs (correct)
- Keywords
- Values
- Operators
Which of the following keywords is used to declare a variable in JavaScript that cannot be reassigned?
Which of the following keywords is used to declare a variable in JavaScript that cannot be reassigned?
- dynamic
- const (correct)
- var
- let
What does the parseInt()
function in JavaScript do?
What does the parseInt()
function in JavaScript do?
What is the purpose of the return
statement in a JavaScript function?
What is the purpose of the return
statement in a JavaScript function?
JavaScript code can only be included in an HTML document directly, not from an external file.
JavaScript code can only be included in an HTML document directly, not from an external file.
In JavaScript, total
and Total
are treated as the same variable.
In JavaScript, total
and Total
are treated as the same variable.
Using mixed data types in JavaScript operations always leads to predictable and desired outcomes.
Using mixed data types in JavaScript operations always leads to predictable and desired outcomes.
The const
keyword in JavaScript allows you to reassign a new value to the declared variable after its initial assignment.
The const
keyword in JavaScript allows you to reassign a new value to the declared variable after its initial assignment.
In JavaScript, function declarations can be called before they are defined in the code due to a feature called hoisting.
In JavaScript, function declarations can be called before they are defined in the code due to a feature called hoisting.
Which of the following best describes a JavaScript object?
Which of the following best describes a JavaScript object?
Which of the following is used to access object methods?
Which of the following is used to access object methods?
What is the correct way to add a new property to an existing JavaScript object?
What is the correct way to add a new property to an existing JavaScript object?
Which of the following is a characteristic of JavaScript objects?
Which of the following is a characteristic of JavaScript objects?
Using the JavaScript Date object, which method returns the month as an index number?
Using the JavaScript Date object, which method returns the month as an index number?
In JavaScript, an object is used to store multiple, unrelated pieces of data.
In JavaScript, an object is used to store multiple, unrelated pieces of data.
A car object can have attributes like color, brand, model and speed.
A car object can have attributes like color, brand, model and speed.
In JavaScript, object property values can only be referenced using dot notation syntax.
In JavaScript, object property values can only be referenced using dot notation syntax.
JavaScript objects are static, meaning you can't add new properties after the object is created.
JavaScript objects are static, meaning you can't add new properties after the object is created.
The JavaScript built-in Array object stores items in individual elements that are numbered starting at 1.
The JavaScript built-in Array object stores items in individual elements that are numbered starting at 1.
Which of the following determines the execution flow of a program?
Which of the following determines the execution flow of a program?
What is the purpose of the if
statement in JavaScript?
What is the purpose of the if
statement in JavaScript?
In a switch
statement, what happens when a break
keyword is encountered?
In a switch
statement, what happens when a break
keyword is encountered?
Which part of a for
loop is responsible for updating the loop counter?
Which part of a for
loop is responsible for updating the loop counter?
What is the key difference between a while
loop and a do...while
loop in JavaScript?
What is the key difference between a while
loop and a do...while
loop in JavaScript?
Control structures determine the execution flow of a program.
Control structures determine the execution flow of a program.
The if
statement executes code regardless of whether the condition is true or false.
The if
statement executes code regardless of whether the condition is true or false.
A switch
statement can be used to perform different actions based on different conditions.
A switch
statement can be used to perform different actions based on different conditions.
In a switch
block, omitting the break
statement will prevent the next case
from being executed, even if it matches.
In a switch
block, omitting the break
statement will prevent the next case
from being executed, even if it matches.
A do...while
loop evaluates the condition before executing the statements within the loop.
A do...while
loop evaluates the condition before executing the statements within the loop.
Flashcards
What is JavaScript?
What is JavaScript?
A language embedded in web browsers that enables client-side scripting, improving web page responsiveness.
Including JavaScript
Including JavaScript
JavaScript can be included directly within HTML using <script>
tags or via external .js
files referenced in the HTML.
JavaScript Statement
JavaScript Statement
A series of instructions executed by the JavaScript engine.
JavaScript Function
JavaScript Function
Signup and view all the flashcards
Scope in JavaScript
Scope in JavaScript
Signup and view all the flashcards
Writing to HTML Elements
Writing to HTML Elements
Signup and view all the flashcards
Keywords in JavaScript
Keywords in JavaScript
Signup and view all the flashcards
JavaScript Variables
JavaScript Variables
Signup and view all the flashcards
Global Scope
Global Scope
Signup and view all the flashcards
parseInt()
parseInt()
Signup and view all the flashcards
What is an Object?
What is an Object?
Signup and view all the flashcards
Object Attributes (Properties)
Object Attributes (Properties)
Signup and view all the flashcards
Object Behaviors (Methods)
Object Behaviors (Methods)
Signup and view all the flashcards
Object Dot Notation
Object Dot Notation
Signup and view all the flashcards
JavaScript Array
JavaScript Array
Signup and view all the flashcards
Object Bracket Notation
Object Bracket Notation
Signup and view all the flashcards
Prototype Inheritance
Prototype Inheritance
Signup and view all the flashcards
getFullYear()
getFullYear()
Signup and view all the flashcards
getMonth()
getMonth()
Signup and view all the flashcards
Extending Objects
Extending Objects
Signup and view all the flashcards
What are Control Structures?
What are Control Structures?
Signup and view all the flashcards
What is an if
statement?
What is an if
statement?
Signup and view all the flashcards
What does else
do in an if
statement?
What does else
do in an if
statement?
Signup and view all the flashcards
What is a switch
statement?
What is a switch
statement?
Signup and view all the flashcards
What is a while
loop?
What is a while
loop?
Signup and view all the flashcards
Extending If with Else
Extending If with Else
Signup and view all the flashcards
For loop
For loop
Signup and view all the flashcards
Do While Loop
Do While Loop
Signup and view all the flashcards
Break Statement
Break Statement
Signup and view all the flashcards
Continue Statement
Continue Statement
Signup and view all the flashcards
Study Notes
- Control structures determine the execution flow of a program.
- Control structures facilitate conditional execution and looping.
- Control structures enable decision-making and repetitive execution.
- Control structures are essential for efficient coding and logic building.
Branch If
- The
if
statement evaluates a condition. - The
if
statement executes code only if the condition is true. - Syntax for
if
statement:
if (condition) {
// block of code to be executed if the condition is true
}
- Example:
if (hour < 18) {
greeting = "Good day";
}
Branch Alternatives (If/Else)
- Extending
if
withelse
adds an alternative execution path for when the condition is false. - Syntax for
if/else
statement:
if (condition) {
// block of code to be executed if the condition is true
} else {
// block of code to be executed if the condition is false
}
- Example:
if (hour < 18) {
greeting = "Good day";
} else {
greeting = "Good evening";
}
Branch Alternatives (Multiple Branches)
- Multiple branches use subsequent conditional
if
tests at the start of each else statement block. - Syntax for multiple branch
if/else if
statement:
if (condition) {
// block of code to be executed if the condition is true
} else if (condition) {
// block of code to be executed if the condition is false
}
- Example:
if (hour < 18) {
greeting = "Good day";
} else if (hour < 24) {
greeting = "Good evening";
}
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.