3 ms·
Some implementations don't define console, so this wouldn't work in some (for example, Rhino). Something like this would be more universal: if (typeof con
by beatgammit 14y ago
Some implementations don't define console, so this wouldn't work in some (for example, Rhino).
Something like this would be more universal:
if (typeof console === 'object') {
console.log('Hello, World!');
} else if (typeof document === 'object') {
document.write('Hello, World!');
} else {
print('Hello, World!');
}
http://progopedia.com/implementation/rhino/ http://progopedia.com/implementation/rhino/
- cwmma 14y agogod damn rhinoceruses fucking everything up.