0

I tried the following commands on the console:

today = new Date()
Mon Jun 11 2018 12:37:12 GMT+0900 (Japan Standard Time)

I could get its hour by

hourNow = today.getHours()
11

As a newbie in JS, I wanna to get acknowledge all today's methods and attributes, so I test:

dir(today)
Mon Jun 11 2018 12:37:12 GMT+0900 (Japan Standard Time)

It does not work as in python,

In [20]: now = datetime.now()

In [21]: dir(now)
Out[21]:
['__add__',...
 'astimezone',...
  'weekday',
 'year']

Is it possible to retrieve the methods and properties of a specified object as reference in a straight-forward way?

Sow
  • 3
  • 2
  • Be sure to search. Pretty sure this has been asked before. – wazz Jun 11 '18 at 03:53
  • Besides, MDN has a very good reference. For example, [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). In general, for JS, it is easier to look up in documentation (in my opinion, superior to Python's) than by experimentation and introspection on objects. – Amadan Jun 11 '18 at 03:55

0 Answers0