W1 - Programming Constructs Flashcards
What are the 3 programming constructs?
Sequence
Branching
Iteration
What is sequence?
Sequence is code that runs from the top to the bottom in order
What is branching? What is the simplest statement?
Branching breaks sequence so the program jumps to another line (when a condition is met). An if statement is the simplest way.
What is iteration? What is the simplest statement?
Iteration is when a line of code is repeated. A while statement is the simplest way.
What is procedural programming?
The use of sequence, branching and iteration
What do input, output and storage mean?
Input - collect data from the user
Output - give data to the user
Storage - store data values for later use
How is input, output and storage written in JavaScript?
let - store
prompt - user input
console.log - output
How do you change the data type of x into a string or number in JavaScript?
Let x = string (y);
How do you identify data types in JavaScript?
Console.log(typeof(y));