Broadly speaking, yes. Having a good grasp of the APIs available to you means you don’t have to go around reinventing the wheel all the time.
On the other hand, purely as part of the learning process, reinventing the wheel can sometimes be a good exercise.
What’s more valuable than just learning what methods exist is learning which of them are versatile general tools, which are more specialized, which have gotchas if not used carefully, which are deprecated and why, etc.
For example, it’s not that useful to learn that
Date objects have
.getDay() methods unless you also learn that:
.getYear()is broken (use
.getDay()returns the day of the week (use
.getDate()for day of the month).
.getMonth()starts at zero (0 for January, 11 for December), even though
.getDate()starts at one.
- The corresponding methods for hours, minutes, seconds, and milliseconds are all pluralized (