const a = 'juejin'; console.log(a.split('').reverse().join('')) function isReverser(str) { const len = str.length; for (var i = 0; i < len / 2; i ++) { if (str[i] !== str[len - i - 1]) { return false; } } return true; }; isReverser('abba'); console.log(isReverser('abba')); console.log(isReverser('ssdkkjnnew'));