4 ms·
JavaScript example is wrong: <a href="#" onclick="helloWorld(); return false;">Hello World Example</a>
by pud 14y ago
JavaScript example is wrong:
<a href="#" onclick="helloWorld(); return false;">Hello World Example</a>
- cwmma 14y agonone of the JavaScript ones even work in Node.js, I'd probably consider console.log('Hello, world!'); to be the closest to universal one.
- deleted 14y ago[deleted]
- beatgammit 14y agoSome 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.