Please I have used .done() to ensure a function is completely executed before starting to execute next function. I borrowed the idea from Ajax. But it is not working. I keep getting error message done() is not a function. 
Is done() only for Ajax? If yes, how can I accomplish my wish.
document.onreadystatechange = function () {
  if (document.readyState === "complete") {
    //do somethings
  }
}
//This must be completely executed before addNu()
$( "#mybutton" ).click(function() {
  //Do some things
}).done(addNu());
function addNu() {
  //do some things
}
Note that none of the script is async. each must be completed before running the next
 
     
    