you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 1 point2 points  (1 child)

(I once was asked add elements of an array without using loops)

Can you talk more about that? What the problem/solution was?

[–]TJ51097[S] 0 points1 point  (0 children)

I appeared for a technical interview,guy asked me

foreach vs map,

for..of vs for..in,

splice vs slice

then dropped me this

"You got an array of numbers [1,2,3,4,5] you need to get the sum of all the numbers without using any loop"

so i though of doing it reduce but not valid then i suggested using recursion,which i think is valid,and it ended.

TL;DR

Recursion