<script type="text/javascript">
function check() {
// Foo
}
</script>
check()
, using if (check) { .. }
:check()
, using if (check()) { .. }
:check()
, using if (typeof(check) == 'function') { .. }
:check
:checkMe()
, using if (checkMe) { .. }
:checkMe()
, using if (checkMe()) { .. }
:checkMe()
, using if (typeof(checkMe) == 'function') { .. }
: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)
: