what is the code return val + '' === numVal + '' for?
<p>I am reading a book and saw a function, but I could not understand the lines <strong>var numVal = +val; return val + '' === numVal + '';</strong>. Can anyone help explaining it a bit? Thanks in advance!</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;
&lt;script&gt;

function isNumeric(val) {
    var numVal = +val;  // what's this for?
    return val + '' === numVal + ''; // what's this for?
}

function filterNumeric(arr) {
    var result = [];

  for(var i=0; i&lt;arr.length; i++) {
    var val  = arr[i];
        if (isNumeric(val)) {
            result.push(val);
        }
  }

  return result;
}


var arr = ["a",1, 2, "b"];

arr = filterNumeric(arr);
alert(arr);


&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
