DEV Community

Discussion on: Why most Front End Dev interviews (#JavaScript #Typescript) are Shit

Collapse
 
joaovkg profile image
João Kosciuszko

About the sum function one, what is the best way of doing that in ES5? I did like this, but I don't know if it would be the most appropriate way.

function sum(x) {
if (arguments[1] == null) {
return (function(y) {
return 'With currying: ' + (x + y);
})
} else {
return 'Without currying: ' + (arguments[0] + arguments[1]);
}
}

Btw, nice article!

Collapse
 
k_ivanow profile image
Kristian Ivanov

Thanks! I like that you found it useful.

Your solution is pretty straightforward and descriptive. I like it.