When you use arithmetic operators, operands are first converted to numbers.
In the first case, on the left side, you have an empty string. Empty lines will become 0 if they are converted to a number, in accordance with this in the specification.
StringNumericLiteral, empty or containing only a space, is converted to +0.
Since new String is just a string object with null characters, it is empty, and so your first expression evaluates to zero ( 0 * 1 ).
In the second case, new Foo returns an object that cannot be converted to a number. If the object cannot be converted to a number, NaN returned. Quoting the same section in the specification,
If the grammar cannot interpret the string as an extension of StringNumericLiteral, then the result of ToNumber is NaN.
That is why the result of NaN here ( NaN * 5 ).
You can check these things out yourself.
console.log(+(new String()));
source share