加载中...
/**
 * @file 反转句子
 * 
 * 同时满足以下条件:1、去除首尾空格,2、单词间隔中多个空格变成一个;
 * 注意console示例运行结果
 */
function reverseWord(str: string) {
    // 补全此处代码
    throw new Error('功能待实现');
}
console.log(reverseWord('the sky is blue')); // blue is sky the
// 去除首尾空格
console.log(reverseWord("  hello world  ")); // world hello
// 单词间隔中多个空格变成一个
console.log(reverseWord("a good   example")); // example good a
export default {}
答案已隐藏,点击"查看答案"按钮查看参考答案