number1 [javascript] how to parse string to number, Number, parseInt, + Number() converts the type whereas parseInt parses the value of input. Number('123'); parseInt('123', 10); +'123'; Parseing string with non-digit character Number('123 asf'); // NaN parseInt('123 asf'); // 123 As you see, parseInt will parse up to the first non-digit character. On the other hand, Number will try to convert the entire string. binary, decimal parseInt('0101'); // 101 parseInt('010.. 2022. 7. 12. 이전 1 다음