JavaScript Flashcards
all algorithm are made with 3 parts, what are they?
variable, conditionals, and loops. how to save, decide, and repeat.
What is a script?
is a series of instructions a computer can follow step-by-step
how should you start writing a script?
start with the big picture of what you want to achieve and break down into smaller steps.
- define the goal
- design the script
- code each step
what are 2 ways to design a script
p. 18
1. tasks (flowchart)
2. steps (list)
flowchart keys
generic step (rectangle)
event (hexogon 6 sides)
input or output (slanted rectangle)
decision (diamond)
What is the purpose of variables?
to store values. easier to call upon the information and easier to reuse for future.
How do you declare a variable?
variable-keyword variable-name;
var name;
How do you initialize (assign a value to) a variable?
variable-keyword variable-name = value; var word = "word";
What characters are allowed in variable names?
lower and capital letters, $, _, and numbers, but cannot start.
var is what scope variable keyword
function scope
what is let and const variable keyword function
block scope
What does it mean to say that variable names are “case sensitive”?
score and Score are different
What is the purpose of a string?
for text
What is the purpose of a number?
to calculate and measure stuff, financial stuff.
What is the purpose of a boolean?
for decision making
What does the = operator mean in JavaScript?
assignment operator, it assigns/store the value to the variable. value will correlate with the variable.
What does the = operator mean in JavaScript?
assignment operator, it assigns the value to the variable
How do you update the value of a variable?
with an assignment operator, no need for keyword. variable = value
name = “yay”;
What is the difference between null and undefined?
undefined is never assigned by a user/programmer, it is a result that only the browser/javascript will give.
null is a value and is assigned and meant to on purpose.
Why is it a good habit to include “labels” when you log values to the browser console?
to see what that console log is for and easier to read/know when coming back to it later. makes it clear.
Give five examples of JavaScript primitives.
number, string, boolean, null, undefined.
example of uniary operator
typeof
What data type is returned by an arithmetic operation?
number
What is string concatenation?
adding 2 or more strings to make it into one string