Pre-Summer Sale Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: ac4s65

A developer is required to write a function that calculates the sum of elements in...

A developer is required to write a function that calculates the sum of elements in an array but is getting undefined every time the code is executed. The developer needs to find what is missing in the code below.

01 const sumFunction = arr = > {

02 return arr.reduce((result, current) = > {

03 //

04 result += current;

05 //

06 }, 10);

07 };

Which line replacement makes the code work as expected?

A.

03 if(arr.length == 0) { return 0; }

B.

04 result = result + current;

C.

02 arr.map((result, current) = > {

D.

05 return result;

JavaScript-Developer-I PDF/Engine
  • Printable Format
  • Value of Money
  • 100% Pass Assurance
  • Verified Answers
  • Researched by Industry Experts
  • Based on Real Exams Scenarios
  • 100% Real Questions
buy now JavaScript-Developer-I pdf
Get 65% Discount on All Products, Use Coupon: "ac4s65"