Composite data types clarifaction, please

Composite data types are made up, or composed , of primitive data types in a structured format.

kindly explain


const name = prompt('Please enter your name.')alert('Hello') alert(name);

say my name is Bob

how can i write a prompt that reads “Hello, Bob” in 1 pop up?

the given code has 2 pop ups, “Hello” and “Bob”


const name = prompt('Please enter your name.');
alert('Hello, ' + name);
1 Like

Sure… try an array…

positive_integers = [2, 4, 6, 8, 10];

Notice here that positive_integers is an array object which is made up of a list of integers (ints).

Here is another one… an object…

const Car = {
number_of_wheels: 4,
passengers: 2,
model: "Corvette"

Here our Car object is made up of other values including some integers and even a string.

All they are talking about here is that you can build more advanced types using the smaller primitive types working together in a structure like an array, object or function.