This question often stumps even senior developers, although it is actually very simple.
When you hear it, there's no need to overcomplicate things with answers like: there are arrays, objects, functions… - because from the data type perspective in JavaScript, all of these belong to a single non-primitive type - object.
Non-primitive type: object
Almost everything "complex" belongs to object:
{ a: 1 }- an object[1, 2, 3]- an array (but the type is still object)new Date()- a date (also an object)function () {}- a function (technically it is an object, buttypeofreturnsfunctionfor it)
Primitive types (there are 7)
Besides object, JavaScript has 7 primitive types - they are not objects and don't have methods/properties like контейнери (although JS sometimes wraps them in wrapper objects under the hood).
string- strings:hellonumber- numbers:42,3.14,NaN,Infinityboolean- boolean type:true / falsenull- empty value (an explicitly assigned absence of value)undefined- value not assignedsymbol- unique identifiers:Symbol(id)bigint- large integers:123n
In total: 7 primitives + 1 non-primitive type, object. You can read about the difference between null and undefined at https://devs-hive.tech/interview-qa/null-vs-undefined-js.