week 2 Flashcards
4 types of JS variables:
Automatically
Using var
Using let
Using const
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
Automatic Variable
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 let variable
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
const
Primitive Types
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.
Represents both integers and floating-point numbers.
Number:
Represents textual data.
String:
Represents logical true or false values.
Boolean:
Represents integers with arbitrary precision.
BigInt:
Represents unique identifiers.
Symbol:
A variable that has been declared but not assigned a value.
Undefined:
Represents the intentional absence of any object value.
Null:
Non-Primitive (Object) Types:
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.
A collection of properties.
Object:
A list-like object.
Array: