Object detection

<script type="text/javascript">
 function check() {
  // Foo
 }
</script>
Support for check(), using if (check) { .. }:
Support for check(), using if (check()) { .. }:
Support for check(), using if (typeof(check) == 'function') { .. }:
check:

Support for checkMe(), using if (checkMe) { .. }:
Support for checkMe(), using if (checkMe()) { .. }:
Support for checkMe(), using if (typeof(checkMe) == 'function') { .. }:

Err, anyway

If you want to check an element with a certain ID, use both if (document.getElementById) and if (document.getElementById('id').

document.getElementById:
typeof(document.getElementById):

Home - More stuff