题解 | #字符串反转#
字符串反转
https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04
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 result = line.split('').reverse().join(''); // console.log(result) // 方法2: let result = '' for(let i = line.length-1;i>=0;i--){ result += line[i] } console.log(result) } }()