×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

What is the output of the following JavaScript code? | Question 12

61. What will be the output of the following JavaScript code?

<script>
    let cars = ['Honda', 'Hyundai'];
    cars.push('Mahindra');
    document.write(typeof cars + " " + cars);
</script>
  1. array Honda,Hyundai,Mahindra
  2. string Honda,Hyundai,Mahindra
  3. object Honda,Hyundai,Mahindra
  4. object "Honda", "Hyundai", "Mahindra"

Answer: C) object "Honda", "Hyundai", "Mahindra"

Explanation:

The push() method pushes an element at the end of the array. And, typeof returns the type of the object. Here, cars is an array.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.