lundi 2 mai 2016

Theory Javascript concept or a polyfill for avoid non-expected behaviours?

I am very curious for know about it the following code is a "theory Javascript concept" or "A Polyfill for avoid non-expected behaviours".

function checkMyMoneyAt6am(_money){
  if(typeof _money !== 'number' ) return false

  //Do something ...
}

Questions:

  • The way or technique that i use to avoid execute my internal algorithm returning a false value (or whatever) have a name?

  • Do you believe that this code using this technique it's a unit-testable code?

Aucun commentaire:

Enregistrer un commentaire