Objects and primitives in JavaScript

Objects (including arrays, as you already know) are considered to be complex data types. Strings, numbers, booleans are considered to be simple, or primitive data types. They are often called so - primitives, meaning everything that is not an object.

JavaScript has seven primitive data types: string, number, boolean, null, undefined⁅/y ⁆, symbol, bigint. Remember their number and names are often asked in interviews.

Задание 1

Given the following code:

javascriptlet test = {x: 1, y: 2, z: 3};
console.log(test);

What type of data will be output to the console? Is it a primitive or an object?

Задание 2

Given the following code:

javascriptlet test = {x: 1, y: 2, z: 3};
console.log(test.x);

What type of data will be output to the console? Is it a primitive or an object?

Задание 3

Given the following code:

javascriptlet test = [1, 2, 3];
console.log(test);

What type of data will be output to the console? Is it a primitive or an object?

Задание 4

Given the following code:

javascriptlet test = [1, 2, 3];
console.log(test[1]);

What type of data will be output to the console? Is it a primitive or an object?

Задание 5

Given the following code:

javascriptlet test1 = [1, 2, 3];
let test2 = 1;

console.log(test1);

What type of data will be output to the console? Is it a primitive or an object?

Задание 6

Given the following code:

javascriptlet test1 = [1, 2, 3];
let test2 = 1;

console.log(test1[test2]);

What type of data will be output to the console? Is it a primitive or an object?

Задание 7

List all primitive data types in JavaScript without looking into the tutorial.