week 2 Flashcards

1
Q

4 types of JS variables:

A

Automatically
Using var
Using let
Using const

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

In JavaScript, if a variable is assigned without using a declaration keyword (var, let, or const), the variable will be implicitly declared as a global variable, even if it is inside a function or block. This can lead to unintended consequences

A

Automatic Variable

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

is limited to the block, statement, or expression where it’s defined. A block is defined by curly braces {}. This makes it safer for use in loops, conditionals, and other block-level structures.

A

A let variable

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

In JavaScript, it is used to declare variables that cannot be reassigned once they have been initialized. It is very similar to let in terms of scoping (block-scoped) and behavior with hoisting, but it has some unique properties

A

const

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

Primitive Types

A

Number: Represents both integers and floating-point numbers.
String: Represents textual data.
Boolean: Represents logical true or false values.
BigInt: Represents integers with arbitrary precision.
Symbol: Represents unique identifiers.
Undefined: A variable that has been declared but not assigned a value.
Null: Represents the intentional absence of any object value.

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

Represents both integers and floating-point numbers.

A

Number:

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

Represents textual data.

A

String:

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

Represents logical true or false values.

A

Boolean:

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

Represents integers with arbitrary precision.

A

BigInt:

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

Represents unique identifiers.

A

Symbol:

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

A variable that has been declared but not assigned a value.

A

Undefined:

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

Represents the intentional absence of any object value.

A

Null:

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

Non-Primitive (Object) Types:

A

Object: A collection of properties.
Array: A list-like object.
Function: A callable object that performs a task or computes a value.
Date: A built-in object for handling dates and times.
RegExp: A built-in object for regular expressions.
Error: Represents runtime errors.

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

A collection of properties.

A

Object:

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

A list-like object.

A

Array:

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

A callable object that performs a task or computes a value.

A

Function:

17
Q

A built-in object for handling dates and times.

A

Date:

18
Q

A built-in object for regular expressions.

A

RegExp:

19
Q

Represents runtime errors

A

Error:

20
Q

All JavaScript variables must be identified with unique names, these unique names are called

A

identifiers

21
Q

can be short names (like x and y) or more descriptive names (age, sum, totalVolume).

A

Identifiers

22
Q

can be short names (like x and y) or more descriptive names (age, sum, totalVolume).

A

Identifiers

23
Q

When you use—- to declare a variable in JavaScript, you are explicitly defining that variable within a particular scope. Variables declared with—-are function-scoped, meaning they are accessible within the function they are declared in, or globally if declared outside of any function. This is in contrast to assigning a value to a variable without declaring it, which can lead to implicit global variables and unintended side effects.

A

var