When we define a function, where does it go in terms of memory partitions? On the stack like primitive data types? Or on the heap like objects?
When we define a function, where does it go in terms of memory partitions? On the stack like primitive data types? Or on the heap like objects?
Functions are objects. Therefore, the function’s identifier is in the stack, and the function’s value is stored in the heap.