
Content of each div generated by the method
document.getElementById('a').innerHTML
The method document.getElementById('a').innerHTML is used in JavaScript to access and manipulate the HTML content of an element on a web page.
function miFuncion() {
var variableLocal = "Hola"; // Local variable stored in Stack memory
var array = [1, 2, 3]; // Array stored in Heap memory
}
Stack: Stores temporary data, limited size, LIFO, automatic.
Heap: Stores long-term data, no size limit, dynamic.
Primitive Data Types
1. Number: Represents integers and decimals.
2. String: Represents text strings.
3. Boolean: Represents logical values, true or false.
4. BigInt: Represents integers of arbitrary precision.
5. Symbol: Represents unique and immutable values.
6. Null: Represents an intentional null value.
7. Undefined: Represents an uninitialized value.
Reference Data Types
1. Array
2. Date: Represents a date and time.
2. Object: Represents a set of properties and values.
3. Function: Represents a block of code that can be executed.
4. Classes
5. Error: Represents an error that has occurred.
6. Map: An object that maps keys to values.
7. RegExp: Represents a regular expression.
8. Set: A collection of unique values.
Constants are defined using the keyword const and have specific characteristics
and functionalities that differentiate them from variables.
a- A constant must be initialized at the moment of its declaration.
b- Constants have block scope, meaning they are limited to the block in which
they are defined, similar to variables defined with let.
c- The identifier of a constant cannot be reassigned, but this does not mean
that the values it references (such as objects or arrays) are immutable.
This was demonstrated in example 3 above.
d- Constants are useful for values that should not change throughout the
program’s lifecycle, such as mathematical values (e.g., PI),
application settings, API keys.
String templates in JavaScript, also known as template literals, can be assigned to both variables (let, var) and constants (const). There is no restriction limiting the use of template literals only to constants.