I just start learning JavaScript
and I faced with problem: I don't know how to check what exactly I can do with my variables (for example, how I can manage string or array). In Python
there are very useful methods dir()
and help()
that allow user to get list of all applicable methods and find out how to use them:
>>>my_number = 1
>>>dir(my_number)
This will return
['bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
the list of methods I can apply to my_number
variable
Then I can get description of each method:
>>>help(my_number.real)
Help on int object:
class int(object)
| int(x=0) -> integer
| int(x, base=10) -> integer
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is a number, return x.__int__(). For floating point
| numbers, this truncates towards zero...
So is there any similar function in JavaScript
so I can call it like console.log(getAllMethodsFor(myNumber))
? This could significantly simplify process of language learning...