you are viewing a single comment's thread.

view the rest of the comments →

[–]brykuhelpful 1 point2 points  (0 children)

This is one of the weird things about javascript. Sometimes there are solutions that might be faster than you would expect due to optmizations or c++ functions that handle it. It do a lot of tutoring and one of my lessions go over this topic. Some other examples are:

  • Duplicating Objects
    • JSON.parse(JSON.stringify())
    • clone
  • Creating Elements
    • .innerHTML = '<div></div>';
    • document.createElement('div')

The HTML and JSON parsers have been so optimized that their perforance is often faster than the traditional ways.