老师,这样写也可以吗?
来源: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回答
同学你好,思路不同,代码写法就不同。同学这种写法,也是对的。
祝学习愉快!
相似问题