题解 | #数字颠倒#
数字颠倒
https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { // Write your code here while(line = await readline()){ // 方法1: // let str = line.toString() // let result = '' // for(let i = str.length-1;i>=0;i--){ // result+=str[i] // } // console.log(result) // 方法2:使用位数除以10,不进行类型转换 // 方法3: let result = line.split('').reverse().join('') console.log(result) } }()