Date/Time functions

  1. Constructors
  2. Getter methods
  3. Setter methods
    1. Auto-adjusting
    2. Numeric conversion, date diff
  4. Formatting
    1. Parsing from string, Date.parse

The built-in object for date and time in JavaScript is Date. It handles all functionality: creation, modification and, partially, date formatting.

Events and timing in-depth

  1. JavaScript is single-threaded
  2. Asynchronous events
  3. The setTimeout(func, 0) trick
  4. Synchronous events
  5. JavaScript execution and rendering
  6. Modal and synchronous calls
  7. Script taking too long and heavy jobs
  8. Summary

Internally, the browsers are event-driven. Most actions occur asynchronously and create an event which is appended to the queue.

They are taken from the queue and processed when the time permits. For example:

  • A script has finished loading.
  • Keypress, mousemove.
  • The window is resized.

Many events are integrated with JavaScript and many events are strictly internal.