In JavaScript, the functions can use primitive types (like numbers, strings), objects (like arrays, plain objects, regular expressions, etc) as arguments, and return a primitive type or object too. Let's make a pause and think a bit about fundamentals. Let's see what the concept of the higher-order functions is, and how it can make calculate() function more universal in regards to operations it can support. What about implementing a more universal function that would support more operations on numbers: addition, multiplication, and more. ![]() The numbers are the input, and the function calculate() returns the sum - the output.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |