Trim the spaces before parsing a number

Both `Number()` and `parseInt` accept the spaces in input. But be aware that you could get different result when passing a value with spaces as following:
parseInt(' 5 '); // 5
parseInt('12 345'); // 12, not 12345
To avoid the similar situations, you should remove all spaces before parsing:
parseInt(value.replace(/\s+/g, ''), 10);