I want to know whether a function is exist or is defined before i call it.
I have this line of code:
function renderView(){
// some code
}
I want to know whether a function is exist or is defined before i call it.
I have this line of code:
function renderView(){
// some code
}
You can check the typeof, it returns undefined
if it's not defined or out of scope, and function
if it's a function
if ( typeof renderView == 'function' ) {
// it exists
}