Fundamentals 1: variables & numbers Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a variable?

A

“storage containers” for data in your code

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

3 keywords to declare a variable

A

let
const
var

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

Which of the three variable declarations should you avoid and why?

A

let and const are newer
var can cause unexpected output

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

Identifying some naming conventions for variables in JS

A

use camelCase
no reserved words (keywords)
use english (for future posterity)
meaningful - they indicate what value is stored inside

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

Naming conventions: what can variable names contain?

A

only letters
digits
symbols ($, _)

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

What are operators, operands, and operations?

A

operands are the data acted upon by the operators

operators: mathematical symbol that indicate how data should be treated (x = / * etc)

operations: the calculation that happens

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

Explain the difference between prefixing and postfixing increment/decrement operators

A

prefix - when increment/decrement operator comes before
++count
returns the count after crementing is applied

postfix - when increment/decrement operator comes after
count++
returns the final count before crementing is applied

still quite confused by this

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

Unary vs binary operation?

A

unary - one operand
binary - two operands

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

What will produce a NaN result?

A

computational error, incorrect or undefined mathematical operation

trying to perform any further operations on NaN will still yield NaN

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

Which math operation with NaN will produce a result?

A

NaN * 0 = 1

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

how to check if a value is NaN?

A

isNaN()

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

What does it mean when we call javascript a dynamically typed language?

A

variables and data types are not bound to each other

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