Javascript - Functions as Values
Code Life
By Pierre Marsaa
A Function Is a Value
Since the start of this class, you've seen that a function can be stored in a variable. That works because in JavaScript a function is a value, like a number or a string. typeof even has a word for it:
↗️
Loading editor...
↶
↷
And like any value, a function can be copied into another variable. Both names then point to the same function:
↗️
Loading editor...
↶
↷
Verify