javascript check if code is nodejs

JavaScript
const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
Source

Also in JavaScript: