1.

The reduce and reduceRight methods follow a common operation called __________(a) filter and fold(b) inject and fold(c) finger and fold(d) foldThis question was addressed to me in an internship interview.The question is from Array and Related Methods topic in portion Lexical Structures of JavaScript

Answer»

Correct choice is (b) inject and fold

The EXPLANATION: The reduceRight() METHOD reduces the array to a single value. The reduceRight() method executes a provided function for each value of the array (from right-to-left). The return value of the function is stored in an ACCUMULATOR (result/total). HENCE it does the operation of INJECTING and folding.



Discussion

No Comment Found

Related InterviewSolutions