1. function trim(str) {
    2. return str.replace(/^\s+/g, '').replace(/\s+$/g, '')
    3. }