Test

Run Settings
LanguageJavaScript
Language Version
Run Command
function stringRev(str){ if (typeof str === 'string'){ var resultstring = ''; if (str.length % 2 === 0) { for (let i=0; i<str.length; i=i+2){ let currentBlock = str.slice(i, i+2).split("").reverse().join(""); resultstring+=currentBlock; } } else { for (let i=0; i<str.length-1; i=i+2){ let currentBlock = str.slice(i, i+2).split("").reverse().join(""); resultstring+=currentBlock; } resultstring+=str[str.length-1]; } return resultstring; } else { return 'Wrong string'; } } console.log(stringRev('Helts'));
Editor Settings
Theme
Key bindings
Full width
Lines