I have question in Javascript, what is the function that returns the number of functions are used in the program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have question in Javascript, what is the function that returns the number of functions are used in the program?

Java script

10th Jul 2021, 4:06 AM
Mona Alzaki Alsheikh Alwaseela
Mona Alzaki Alsheikh Alwaseela - avatar
5 Answers
+ 2
function maths(a, b) { function sum() { return a + b; } function subtract() { return a - b; } return {sum, subtract} } const fns = maths(5,3); const total = fns.sum(); console.log(total); const diff = fns.subtract(); console.log(diff); https://code.sololearn.com/cp7FG0J73kNs/?ref=app JavaScript and Node.js have the same basic functionality
11th Jul 2021, 10:10 AM
Calviղ
Calviղ - avatar
0
as far as I know there is no such function... at least in web context (don't know if nodejs has such builtin function or if there exist a module to install such function)... not in ES specifications, in all cases ^^
10th Jul 2021, 4:11 AM
visph
visph - avatar
0
OK thanks for replying.
10th Jul 2021, 4:12 AM
Mona Alzaki Alsheikh Alwaseela
Mona Alzaki Alsheikh Alwaseela - avatar
0
That's means, there is no such function do that in JS right?
10th Jul 2021, 4:13 AM
Mona Alzaki Alsheikh Alwaseela
Mona Alzaki Alsheikh Alwaseela - avatar
0
yes, as far as I know...
10th Jul 2021, 4:15 AM
visph
visph - avatar