We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
// 如果不是大数的情况 // 1. parseInt let str = '123'; let res = parseInt(str); // 2. + let res1 = +str; // 3. ~~ let res2 = ~~str; // 4. Number let res3 = Number(str); // 如果是大数的情况 let res4 = BigInt(str);
Sorry, something went wrong.
function transfrom(str){ let sum = 0; for(let i = 0; i < str.length; ++i){ const value = str.charAt(i); if(value < "0" || value > "9") break; sum *= 10; sum += strToNumber(value); } function strToNumber(char){ switch (char) { case "1": return 1 case "2": return 2 case "3": return 3 case "4": return 4 case "5": return 5 case "6": return 6 case "7": return 7 case "8": return 8 case "9": return 9 default: return 0 } } return sum; } console.log(transfrom("12314sadfa"))
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: