JavaScript with Sequence and Control Flow

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/16

flashcard set

Earn XP

Description and Tags

These flashcards cover key concepts related to sequences, processing, output, and control flow in JavaScript.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

17 Terms

1
New cards

Sequence

The order in which instructions are executed in a program.

2
New cards

Processing

Manipulating or computing data, often involving arithmetic or string operations.

3
New cards

Output

How a program communicates results to the user, commonly through console.log(), alert(), or document.write().

4
New cards

Control Flow

Determines the order in which instructions are executed in a program.

5
New cards

if Statement

A conditional statement that executes a block of code only if the condition is true.

6
New cards

if…else Statement

A conditional statement that provides an alternative block of code to execute if the initial condition is false.

7
New cards

if…else if…else Statement

A conditional statement useful for checking multiple conditions.

8
New cards

switch Statement

A control structure that executes code based on discrete values of an expression.

9
New cards

for Loop

A control flow statement that repeatedly executes a block of code a specified number of times.

10
New cards

while Loop

A control flow statement that repeatedly executes a block of code as long as a specified condition is true.

11
New cards

Input

How a program receives data from the user or external sources.

12
New cards

What are the three optional parts of a for loop's header statement?

Initialization, condition, and increment/decrement.

13
New cards

When is a for loop typically preferred over a while loop?

When the number of iterations is known beforehand.

14
New cards

What is a key difference between for and while loops regarding their termination condition?

A for loop's iteration count is often predetermined, while a while loop continues as long as a condition remains true, making it suitable for situations where the number of iterations is unknown.

15
New cards

What risk is associated with a while loop if its condition never becomes false?

An infinite loop, which can cause a program to freeze.

16
New cards

What are common ways a program can receive input from a user in a web browser?

Through form fields (e.g., <input>, <textarea>), prompt dialogs, or event listeners (e.g., keydown, click).

17
New cards

Besides user interaction, what are other sources of input for a program?

Data from files, network requests, databases, or sensors.