Fundamentals Flashcards

Assignment operators, string interpolation, variables, methods, etc.

1
Q

What are assignment operators?

A

Assign a value to its left operand based on the value of its right operand.

+= addition assignment
-= subtraction assignment
*= multiplication assignment
/= division assignment

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

What is string interpolation?

A

Process of evaluating string literals containing one or more placeholders (expressions, variables, etc)

Performed using template literals like:
Hi ${userName} welcome to the app;

Performed using string concatenation like:
‘Hi ‘ + userName + ‘ welcome to the app’;

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

What are variables and how can you declare them?

A

Variables are used to store data in memory and ensure code re-usability. They are referenced by name.

Types: const, let, and previously var

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

What is a template literal?

A

Strings that allow embedded expressions. Use backticks instead of quotes.

let name = “Kristin”;
console.log(Hello, ${name});

console.log(Billy is ${6+8} years old.);

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

let

A

creates a local variable that can be re-assigned
initialization is optional
will contain ‘undefined’ if nothing is assigned to it

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

const

A

creates a local variable that cannot be re-assigned
initialization is required
will throw a runtime error if not assigned

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

String Concatenation

A

Creates a new string by concatenating multiple other strings together using the addition+ operator

let welcomeMsg = ‘Hi ‘ + userName + ‘ welcome to the app’

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

console.log()

A

used to log or print messages, objects, and other information to the console

console.log(‘some important message’)

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

What are methods?

A

They return information about an object and are called by appending an instance with a period, the method name, and parentheses

Math.random(); //returns a number between 0 -1

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

undefined

A

a primitive JS value that represents lack of a defined value

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

null

A

a primitive JS data type that represents the intentional absence of a value

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

Arithmetic Operators

A

+ addition
- subtraction
* multiplication
/ division

% modulo - returns the number that remains after the right-hand number divides into the left-hand number as many times as it can

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