当前位置:网站首页>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>
边栏推荐
- 请问sql group by 语句问题
- Ravendb starts -- document metadata
- Why do job hopping take more than promotion?
- Simple continuous viewing PTA
- Reinforcement learning - learning notes 5 | alphago
- Redis insert data garbled solution
- Variable star --- article module (1)
- Laravel notes - add the function of locking accounts after 5 login failures in user-defined login (improve system security)
- Forward maximum matching method
- KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
猜你喜欢

Common English vocabulary that every programmer must master (recommended Collection)

Why do job hopping take more than promotion?

2017 8th Blue Bridge Cup group a provincial tournament

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

每个程序员必须掌握的常用英语词汇(建议收藏)

Study notes of grain Mall - phase I: Project Introduction

Introduction to the use of SAP Fiori application index tool and SAP Fiori tools

审稿人dis整个研究方向已经不仅仅是在审我的稿子了怎么办?

数据湖(八):Iceberg数据存储格式

3D face reconstruction: from basic knowledge to recognition / reconstruction methods!
随机推荐
js中,字符串和数组互转(一)——字符串转为数组的方法
代理和反向代理
C language games - three chess
Web开发小妙招:巧用ThreadLocal规避层层传值
Aike AI frontier promotion (7.6)
15million employees are easy to manage, and the cloud native database gaussdb makes HR office more efficient
[MySQL] basic use of cursor
R语言可视化两个以上的分类(类别)变量之间的关系、使用vcd包中的Mosaic函数创建马赛克图( Mosaic plots)、分别可视化两个、三个、四个分类变量的关系的马赛克图
1_ Introduction to go language
Math symbols in lists
数据湖(八):Iceberg数据存储格式
[asp.net core] set the format of Web API response data -- formatfilter feature
After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers
for循环中break与continue的区别——break-完全结束循环 & continue-终止本次循环
968 edit distance
Why do job hopping take more than promotion?
[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics
User defined current limiting annotation
OSPF multi zone configuration
Data Lake (VIII): Iceberg data storage format