How to detect different JavaScript runtimes

As more and more JavaScript runtimes become popular, and each runtime has some subtle differences in how modules/functions behave , if we want to support our JavaScript code in these runtimes, we should be able to detect the runtime. Ideally we should check the supported feature, instead of the runtimes, but in case if we want to detect the runtimes themselves, here are the checks we can do if (…