1 Star 0 Fork 84

惨绿青年/前端77

forked from 万少/前端77 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
20-数组-some.html 938 Bytes
一键复制 编辑 原始数据 按行查看 历史
万少 提交于 2022-05-13 18:03 . 数组方法-some
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no"
/>
<title>20-数组-some.html</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
</style>
</head>
<body>
<script>
// some 检测数组元素中 只有有一个条件 都返回true
const arr = [
'健康',
'健康',
'健康',
'健康',
'健康',
'健康',
'健康',
'健康',
'健康',
'健康',
];
// some方法来判断 队列 是不是有危险
const result = arr.some((value) => value === '中招');
if (result) {
console.log('有危险');
} else {
console.log('健康');
}
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/miserable-green-youth/front-end-77.git
git@gitee.com:miserable-green-youth/front-end-77.git
miserable-green-youth
front-end-77
前端77
js高级第1天

搜索帮助