[Solved] how to check if a function exists [duplicate]


function sb_save(){
alert('saving');
}

$('button').on('click', function(){
 if (typeof sb_save==="function"){
sb_save();
 }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>Click</button>

2

solved how to check if a function exists [duplicate]