Why the f-I does not return a value?

0 like 0 dislike
9 views
const test = (arg) => { return arg }; const final = (arg) => test => { test(arg) } final("test");
Code
As I understand it, the f-th final we pass the argument arg and pre-generated f-th test, and in the body of f-and final we call f-u test(). It?
For some reason, I do not receive values from the call to final("test");
by | 9 views

3 Answers

0 like 0 dislike
rewrite the old way, and you will see that there is generally some crap...
const test = function(arg) { return arg; } const final = function(arg) { return function(test) { test(arg); } } final('test');


Actually should return a function, the argument is lost (not used) well, etc.

UPD
Launched your code in the console. Actually a function and returns
5aec3736cba4e408328103.png
by
0 like 0 dislike
Remove the excess.
const test = (arg) => { return arg }; const final = (arg) => test(arg) final("test"); /* test */
by
0 like 0 dislike
You have no return
const final = (arg) => test => { return test(arg) }

Or you can do so:
const final = (arg) => test => test(arg);
by

Related questions

110,608 questions
257,186 answers
0 comments
33,854 users