老师,这样写也可以吗?

来源:2-7 编程练习

廖可爱bongbong

2021-06-26 15:15:40

<!DOCTYPE html>

<html>


<head>

   <meta charset="UTF-8" />

   <title>document</title>

</head>


<body>

   <script type="text/javascript">

      const m = new Map([

         ['apple''10'],

         ['strawberry''5'],

         ['Banana''0']

      ])

   // 在此补充代码

    for (const [key,value] of m){


        // console.log(`${key.padEnd(20,' -')}${value.padStart(10,'conut: 00')}`);


        console.log(`${key.padEnd(20,' -').padEnd( 26,'Conut:')}${value.padStart(4,' 000')}`);

    }


   </script>

</body>


</html>


写回答

1回答

好帮手慕久久

2021-06-26

同学你好,思路不同,代码写法就不同。同学这种写法,也是对的。

祝学习愉快!

0

0 学习 · 15276 问题

查看课程