×

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 16

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

<script>
	var cars = ["Honda","Hyundai","Mahindra"];
	
	var result = cars.shift();
	
	document.writeln("Result: ", cars);
</script>
  1. Result: Honda,Hyundai,Mahindra
  2. Result: Honda
  3. Result: Hyundai,Mahindra
  4. Result: Honda,Mahindra

Answer: C) Result: Hyundai,Mahindra

Explanation:

In the above JavaScript code, we used the shift() method which is used to remove the first element of the given array and return that element. This method changes the length of the original array. Thus, the output would be "Result: Hyundai,Mahindra".

Comments and Discussions!

Load comments ↻






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