unit 4 Flashcards

1
Q

what is a variable?

A

container for storing value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does the computer do once a variable is created?

A

stores it in memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is the code for a variable?

A

var + label

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

when should we use var?

A

to change its value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

where are the positions of the label and value?

A

label left, value right

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

initializing the varable

A

creating and assigning variable value right away
var lives = 3;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

initializing the variable

A

creating and assigning variable value right away
var lives = 3;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does ‘=’ mean?

A

gets the value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how do you use a variable?

A

refer it by its label

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

how can you see the value of a variable?

A

by using console.log as we can’t visually see it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is the difference between writing the variable’s label with quotations and without?

A

with - refers to the name itself
without - refers to the value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

if a variable is not declared what happens?

A

the program does not know what it is and an error occurs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

example of variables in expression

A

var score = 3;
var newScore;
newScore = score + 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is different with variables when you use expressions?

A

you don’t assign a value directly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how much a computer determine an expression

A

use the current value and manipulate it (add, subtract etc) the way the expression wants it to
computer picks apart the expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

variable re-assignment

A

updating values of variables

17
Q

why does the order of variables matter?

A

in expressions, the updates change right then and then that new value is applied to the next line

18
Q

how does a computer make decisions to see what action to take next?

A

true or false

19
Q

what is a boolean expression?

A

can be either true/false
computer can evaluate it

20
Q

what is the equality operator?

A

==

21
Q

what is the assignment operator?

A

=

22
Q

what are comparison operators?

A

> , >=, <, <=, !=

23
Q

what do operators do?

A

propose a question for the computer to answer

24
Q

what are conditional statements?

A

tells computer to run specific code if something is true

25
Q

types of conditional statement

A

if
if-else
if-else-if

26
Q

how does computer check codes?

A

top to bottom

27
Q

OR operators

A

||
true when at least one condition is true

28
Q

AND operators

A

&&
true when both conditions are true

29
Q

how do computers use conditional statements?

A

use it to adapt to changes

30
Q

what is a function?

A

define your command and giving it a name

31
Q

2 steps to use a function

A
  1. define- give a single name to a set of actions you want to perform
  2. call - type name of function followed by ()
32
Q

where do you place the definition of the function in a code?

A

anywhere as the computer will search for it
but for organization, usually placed at the end

33
Q

the javascript term is function, but what is the general term?

A

procedure