📜  打字稿代码示例中的反向字符串

📅  最后修改于: 2022-03-11 14:48:30.161000             🧑  作者: Mango

代码示例1
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.