Does the content of Array has its own type? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Does the content of Array has its own type?

Such as String,Int and so on

8th Mar 2018, 7:11 AM
征帆却
征帆却 - avatar
2 Answers
+ 4
var array=["boy",1,true]; alert(typeof array[0]) //string alert(typeof array[1]) //number alert(typeof array[2]) //boolean alert(typeof array ) //object This applies to JavaScript,in other languages like java the elements in the array have the same data type as array
8th Mar 2018, 8:52 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 1
Yes. Arrary is array type. You can nested other types in it.
8th Mar 2018, 7:20 AM
Sylar