×

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 14

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

<script>  
	var msgs=new Array("Hello","Hey","Morning!");  

	for (i=0;i<msgs.length;i++){  
		document.write(msgs[i] + " | ");  
	}
</script>
  1. Hello | Hey | Morning! |
  2. Hello | Hey |
  3. ValueError
  4. TypeError

Answer: A) Hello | Hey | Morning! |

Explanation:

In the above JavaScript code, the array is declared using the new operator and all elements are printing using the loop. Thus, the output would be "Hello | Hey | Morning! |".

Comments and Discussions!

Load comments ↻






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