Benchmark any real web page and it's highly unlikely the kind of examples shown here are anywhere close to the bottlenecks causing a page to be slow. You can always make code faster by adding more handling of specific cases, but it's only worthwhile to do that when it has a significant effect on bottlenecks. That's especially true in JavaScript where size can be just as much of a performance enemy as execution time.
Running to my car in the garage is four times faster than walking to my car, but it makes no real difference in time when I get in and drive 500 miles.
Benchmark any real web page and it's highly unlikely the kind of examples shown here are anywhere close to the bottlenecks causing a page to be slow. You can always make code faster by adding more handling of specific cases, but it's only worthwhile to do that when it has a significant effect on bottlenecks. That's especially true in JavaScript where size can be just as much of a performance enemy as execution time.
Running to my car in the garage is four times faster than walking to my car, but it makes no real difference in time when I get in and drive 500 miles.