Converting a 'string number' to a number
<p>I'm creating a library and trying to send a string into the function and return it as a Number, while creating a conditional to determine if the string sent into the function is a number before I do the conversion.</p>

<pre><code>var strNum = function(val){
    if (!isNan(val)){
        console.log('This is a string that can be converted')
        parseInt(val)
        return val
    }else{
        console.log ('This sting is not a "number"');
    }
};
</code></pre>

<p>This is what I have but when debugging it I get an error of 
<em>"ReferenceError: isNan is not defined if (val = !isNan(val)){"</em> 
and I'm not sure why its isn't working!</p>

<p>Any thoughts?</p>
