Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to iterate over the static variables and methods of a class with CoffeeScript?

Using CoffeeScript, I would like to be able to iterate over the static methods and variables of a class. More specifically, I'd like to gain access to all of the functions in Math.

I'm looking for functionality similar to:

for x in Math
    console.log (x + ": " + Math[x])

Is this possible?

like image 896
JeremyFromEarth Avatar asked Oct 23 '25 14:10

JeremyFromEarth


1 Answers

From a previous stackoverflow question: How can I list all the properties of Math object?

Object.getOwnPropertyNames( Math )
like image 153
hpaulj Avatar answered Oct 25 '25 03:10

hpaulj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!