199k views
2 votes
What does the following code alert? var person = { name: "Mike", age: 25, favoriteFood: "pizza" }; alert("My best friend's name is" + person.name + ",he's " + person.age + " years old and his favorite food is " + person.favoriteFood);

· My best friend's name isMike,he's 25 years old and his favorite food is pizza

· My best friend's name is Mike, he's 25 years old and his favorite food is pizza.

· My best friend's name isMike ,he's 25 years old and his favorite food is pizza.

· My friend's best name isMike,he's 25 years old and his favorite food is pizza.

User Divyank
by
5.2k points

2 Answers

3 votes

Answer:

My best friend's name isMike,he's 25 years old and his favorite food is pizza

Step-by-step explanation:

User Kanishka
by
5.1k points
5 votes

Answer:

· My best friend's name is Mike, he's 25 years old and his favorite food is pizza.

Step-by-step explanation:

The codes shown in the question above reveal the following information: My best friend's name is Mike, he's 25 years old and his favorite food is pizza.

It is as if the first code sequence shown in the question provides answers to the second code sequence. This occurs as follows:

  • "My best friend's name is" + person.name = name: "Mike"
  • ", he is" + person.age = age: 25 years old
  • "and your favorite food is" + person.favoriteFood = favorite food: "pizza".

Adding all the results we have the phrase: "My best friend's name is Mike, he's 25 years old and his favorite food is pizza."

User Nvoigt
by
4.4k points