JavaScript umgekehrt eine Zeichenfolge umgekehrt
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
Grepper
function reverseString(s){
return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
//more compact way:
"my example text".split("").reverse().join("");
let toBeReversed: string = `.eslaf eb t'ndluow ecnetnes siht ,dehctiws erew eslaf dna eurt fo sgninaem eht fI`;
let charArray: string[] = toBeReversed.split('');
console.log(charArray);
let reverseArray: string[] = charArray.reverse();
console.log(reverseArray);
let reversedArray: string = reverseArray.join('');
console.log(reversedArray);
output:
If the meanings of true and false were switched, this sentence wouldn't be false.