4-liner JavaScript solution


  • 0
    K
    var isNumber = function(s) {
        var notJustSpaces = [].slice.call(s).some((sChar) => sChar !== " ");
        return notJustSpaces && !Number.isNaN(+s);
    };
    

    I feel like I cheated since JavaScript loves to do a lot of hand holding.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.