One of the effective ways is to pass the value through the Number object. If it's not a valid number, it will return NaN (not a number).
Since NaN is a falsy value, you can use the OR operator to provide a default value of 0 if no valid number can be made.
var string = field.value;
var number = Number(string) || 0.