Functional Programming with Typescript - Ternary and Recursion

preview_player
Показать описание
In this video we will look at some workarounds for the limitations functional programming comes with.
Рекомендации по теме
Комментарии
Автор

Another way that i use in case of multiple conditions is to 'encapsulate' in a function and return the value itself like that:

const condition = true;
const result = getResult(condition);

const getResult = (condition: boolean) => {
if(condition)
return 'the condition is true';

return 'the condition is false';
}

I don't know if it's correctly or if is functional, but works well for me. Thank you for the video by the way, keep with the great job.

BrunoRibeiroDev
Автор

What if you have to sum from 0 to (call stack size + 1)? This recursive approach would not work then, right?

TheSaintsVEVO
visit shbcf.ru