This content originally appeared on DEV Community and was authored by Calin Baenen
So, as MDN (Mozilla Developer Network) says, Function.caller
is not only deprecated, but removed from the Relevant Web Standards.
But, this isn't good for me, as I want to know what function is calling a function I have.
I have a set of private variables, and I only want "friend functions" to see those variables without having to return every function from another function. (Also because these private variables are user-defined, and thus can't be predicted, or written in advance.)
So, I was wondering, does modern JS provide anything similar to Function.caller
?
Thanks!
Cheers!
This content originally appeared on DEV Community and was authored by Calin Baenen
Calin Baenen | Sciencx (2021-11-19T01:20:19+00:00) Is there a suitable equivalent to `Function.caller` in modern JS?. Retrieved from https://www.scien.cx/2021/11/19/is-there-a-suitable-equivalent-to-function-caller-in-modern-js/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.