目录 5. trim方法 6. 对象方法 6.1 Object.keys() 6.1.1 作用 6.1.2 语法 6.2 Object.defineProperty() 6.2.1 作用 6.2.2 语法 5. trim方法 去除字符串两端的空格 var str = ' helloWorld ' console.log(str.trim() //输出helloWorld 去除两端空格 var str1 = ' he l l oWorld ' console.