当前位置:网站首页>JS traversal array and string
JS traversal array and string
2022-07-06 21:10:00 【viceen】
js Traversal array of 、 character string
1、 Traversal array
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Traversal array </title>
</head>
<body>
<script> const arr = [11, 22, 33, 44, 55, 66] // Create array // Traversal array for (let i = 0; i < arr.length; i++) {
console.log(arr[i]) } // Traversal array for (let key in arr) {
console.log(key + '---' + arr[key]) } // Traversal array for (let key of arr) {
console.log(key); } // Traversal array </script>
</body>
</html>
2、 Traversal string
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Traversal string </title>
</head>
<body>
<script> let data1 = " Hello , hi , hello ,Hi,Hello, I'm very glad to "; let arr1 = data1.split(","); // String to array ( adopt ",") console.log("arr1:", arr1); for (let i = 0; i < arr1.length; i++) {
console.log(arr1[i]) } </script>
</body>
</html>
边栏推荐
- Can novices speculate in stocks for 200 yuan? Is the securities account given by qiniu safe?
- 每个程序员必须掌握的常用英语词汇(建议收藏)
- Nodejs tutorial expressjs article quick start
- [MySQL] trigger
- 2022菲尔兹奖揭晓!首位韩裔许埈珥上榜,四位80后得奖,乌克兰女数学家成史上唯二获奖女性
- 【mysql】触发器
- 华为设备命令
- Select data Column subset in table R [duplicate] - select subset of columns in data table R [duplicate]
- Thinking about agile development
- The most comprehensive new database in the whole network, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, flying Book Multidimensional table, heipayun, Zhix
猜你喜欢
【微信小程序】運行機制和更新機制
What is the problem with the SQL group by statement
Reviewer dis's whole research direction is not just reviewing my manuscript. What should I do?
OAI 5g nr+usrp b210 installation and construction
966 minimum path sum
None of the strongest kings in the monitoring industry!
拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条
Is this the feeling of being spoiled by bytes?
【mysql】触发器
愛可可AI前沿推介(7.6)
随机推荐
1500萬員工輕松管理,雲原生數據庫GaussDB讓HR辦公更高效
SAP UI5 框架的 manifest.json
@GetMapping、@PostMapping 和 @RequestMapping详细区别附实战代码(全)
快过年了,心也懒了
el-table表格——sortable排序 & 出现小数、%时排序错乱
新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
[wechat applet] operation mechanism and update mechanism
How do I remove duplicates from the list- How to remove duplicates from a list?
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
C language operators
Dynamically switch data sources
【OpenCV 例程200篇】220.对图像进行马赛克处理
Forward maximum matching method
OneNote 深度评测:使用资源、插件、模版
全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
##无yum源安装spug监控
KDD 2022 | realize unified conversational recommendation through knowledge enhanced prompt learning
'class file has wrong version 52.0, should be 50.0' - class file has wrong version 52.0, should be 50.0
【论文解读】用于白内障分级/分类的机器学习技术
Spiral square PTA