• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in JavaScript by

Which one of the following options is the correct output for the given code of java script?

var sum=0;  









a) 70

b) 75

c) 482

d) error

1 Answer

0 votes

Answer: C

Reason: The "forEach()" method used in the above given code is one of the built-in method of JavaScript. This method traverses the whole array just like we use the "for" loop to traverse the array. The term traverse is referred to "going or accessing each element of the array at least one time".

Related questions

0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
+1 vote
asked Mar 22, 2021 in JavaScript by Robindeniel