I have this code that works in Chrome, but doesn't work as expected in Safari:
if (typeof myFunction !== 'function') {
function myFunction() {
console.log('myFunction invoked');
}
myFunction();
} else {
console.log('myFunction ALREADY DEFINED o_O!');
}
When I run this code in Chrome – it logs "myFunction invoked".
When I run it in Safari – it logs "myFunction ALREADY DEFINED o_O!"
I want to make typeof work in Safari the same as in Chrome. How can I achieve it?