5. Heterogeneous arrays


#1


Create a heterogeneous array called myArray with at least three elements. The first element should be a number, the second should be a boolean (true or false), and the third should be a string. Feel free to add more elements of any type if you like!


I get syntax error


var myArray = [ 1, 2,23, 45];
var element = [ "boolean"(true or false)];
var string =[ "subash", "sunil",1,4];


#2

element is
[element0, element1, ..., elementN]

Create a heterogeneous array called myArray
var myArray=[ ]
now in this array first element should be a number, the second should be a boolean (true or false), and the third should be a string

for boolean value you just have to write

true or false // anyone not both


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.