Use functions instead of strings as the argument of setTimeout() and setInterval()
Functions or character strings can be passed as arguments to SetTimeout() and setInterval(). In keeping with the previous best practice, using eval() and thus passing character strings is not recommended. Furthermore, if the argument passed is a string, it has to be evaluated by the interpreter before being converted into code. On the other hand, if this argument is a function or a reference to a function, no evaluation is needed, reducing CPU usage.
Avoid using bitmap images for the interface
It is important to choose the right image format to avoid sending unnecessary bytes and thus save bandwidth. Moreover, vectors should be used instead of bitmaps as screens and resolutions continue to grow.
By doing so, the interface does not depend on the screen’s resolution. This also limits the technical debt.
The first rule is to replace bitmap images (GIF, PNG, JPEG, WebP, etc.) with styles (CSS), pictograms, glyphs or icons provided for by a web font or standard typeface. This prevents the user from having to download additional resources.
If you are unable to use CSS or a standard typeface (already installed on the user’s device), you could instead use:
- a web font
- standard .SVG vector images








