Studying JavaScript?

Studying JavaScript?
0.0 0


JavaScript as we all is know filled with many different methods. Would it be a good idea to manually study most of the string and array methods to assist ones journey through algorithms and just for having a good understanding the language?


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 .getYear(), .getMonth(), and .getDay() methods unless you also learn that:

  • .getYear() is broken (use .getFullYear() instead).
  • .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 (.getHours(), .getMinutes(), etc.)