I noticed that the correct
return str.slice(0, res);
returns the same value as the incorrect
var str = "some_string";
return str.slice(str, res);
In this case str is a string and res is a numeric quantity.
My guess is that some how because slice expects a numeric quantity and does not get one ( for the first parameter ), it converts what it finds to a 0.
Is this expected behavior?
strcannot be converted to a value different fromNaN. See es5.github.io/#x9.4.5(as opposed to the integer5) to be a "numeric quantity"?