β¨ Basic
Of course, it works.
const num = "123";
Number(num) + // 123
+num; // 123
β¨ Convert by character
Sometimes it's necessary to convert the string number by character.
const strNumber = "123";
let num = 0;
for (const n of strNumber) {
num = num * 10 + Number(n);
}