Object.fromEntries

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Object.fromEntries</title>
</head>

<body>
  <script>
    // Object.fromEntries:把二维数组转为对象
    // Object.entries:将把对象转为二维数组,ES8 

    // 二维数组
    const result = Object.fromEntries([
      ['name', '哈哈'],
      ['job', 'Java, 大数据, 前端, 云计算']
    ]);
    console.log(result) // {name: "哈哈", job: "Java, 大数据, 前端, 云计算"}

    // Map
    const m = new Map();
    m.set('name', 'haha');
    const result2 = Object.fromEntries(m);
    console.log(result2) // {name: "haha"}


    const arr = Object.entries({
      name: "哈哈"
    })
    console.log(arr); // 
    console.log(arr[0], arr[0][0], arr[0][1]); // ["name", "哈哈"] "name" "哈哈"
  </script>
</body>

</html>

trimStart 和 trimEnd

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>trimStart 与 trimEnd</title>
</head>
<body>
    <script>    
        // trim
        let str = '   i love you   ';

        console.log(str);
        console.log(str.trim())
        console.log(str.trimStart());
        console.log(str.trimEnd());
    </script>
</body>
</html>