I hope you all doing good.
I have one question, as they say all Data types are wrapped or treated as Objects, then how come array is also being treated as Objects?
They are not a data Type!
An array is a data type of type array. In a strongly typed language you even have to specify the types that the array stores. So for example, an
array<int> is quite different from an
(Note: a common size for an int is 4 bytes and for a char 1 byte. So if you initialize an
array<int> of size 10 this would by 40 bytes large whereas an
array<char> of size 10 would be 10 bytes in comparison).
HI, thankyou sir for your response, but I did not understand it.
Welcome to programming!
I’m basically saying: an array is a data type (by definition). So then there’s no problem with it being an being an object.
Arrays are also objects, that is what comes up with
array =  console.log(typeof array) // 'object'
JS has a built in object constructor,
console.log(array.constructor) // [Function: Array]
That makes it an instance of Array…
console.log(array instanceof Array) // true
The Array constructor has a class method,
console.log(Array.isArray(array)) // true
This reply was meant for an hour ago but I got called away.
Thankyou so much sir and thankyou for the explanation. I really appreciate it sir @toastedpitabread
Thankyou so much @mtf sir, No problem I really appreciate you guys taking time for helping me out!