📅  最后修改于: 2022-03-11 15:04:07.845000             🧑  作者: Mango
const sentence = ' My string with a lot of Whitespace. '.replace(/\s+/g, ' ').trim()
// 'My string with a lot of Whitespace.'