Implementation of isNumber  function