为什么两种写法得出的结果不一样呢
这个是一行效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
document.write( [...new Set( 'study hard and make and progress every day study')].join(''));
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let str ="study hard and make and progress every day study";
let a=str.split(" ");
document.write( [...new Set( a)].join(' '));
</script>
</body>
</html>
正在回答
同学你好,第一句理解的是对的,第二句是每个字母为一个整体去重。
祝学习愉快~
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星