当前位置:网站首页>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>
边栏推荐
- Pinduoduo lost the lawsuit, and the case of bargain price difference of 0.9% was sentenced; Wechat internal test, the same mobile phone number can register two account functions; 2022 fields Awards an
- R language visualizes the relationship between more than two classification (category) variables, uses mosaic function in VCD package to create mosaic plots, and visualizes the relationship between tw
- 20220211 failure - maximum amount of data supported by mongodb
- Select data Column subset in table R [duplicate] - select subset of columns in data table R [duplicate]
- js通过数组内容来获取数组下标
- Introduction to the use of SAP Fiori application index tool and SAP Fiori tools
- Web开发小妙招:巧用ThreadLocal规避层层传值
- No Yum source to install SPuG monitoring
- MLP (multilayer perceptron neural network) is a multilayer fully connected neural network model.
- 硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
猜你喜欢

【mysql】游标的基本使用

Is it profitable to host an Olympic Games?

Study notes of grain Mall - phase I: Project Introduction

This year, Jianzhi Tencent

Is this the feeling of being spoiled by bytes?

性能测试过程和计划

KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐

Statistical inference: maximum likelihood estimation, Bayesian estimation and variance deviation decomposition

After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers

【OpenCV 例程200篇】220.对图像进行马赛克处理
随机推荐
15 millions d'employés sont faciles à gérer et la base de données native du cloud gaussdb rend le Bureau des RH plus efficace
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
2017 8th Blue Bridge Cup group a provincial tournament
【论文解读】用于白内障分级/分类的机器学习技术
Nodejs教程之Expressjs一篇文章快速入门
js中,字符串和数组互转(一)——字符串转为数组的方法
What key progress has been made in deep learning in 2021?
R语言可视化两个以上的分类(类别)变量之间的关系、使用vcd包中的Mosaic函数创建马赛克图( Mosaic plots)、分别可视化两个、三个、四个分类变量的关系的马赛克图
Is it profitable to host an Olympic Games?
Yyds dry goods count re comb this of arrow function
Redis insert data garbled solution
Leetcode hot topic Hot 100 day 32: "minimum coverage substring"
【滑动窗口】第九届蓝桥杯省赛B组:日志统计
Comprehensive evaluation and recommendation of the most comprehensive knowledge base management tools in the whole network: flowus, baklib, jiandaoyun, ones wiki, pingcode, seed, mebox, Yifang cloud,
What is the problem with the SQL group by statement
[sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics
PG basics -- Logical Structure Management (transaction)
什么是RDB和AOF
1_ Introduction to go language
Kubernetes learning summary (20) -- what is the relationship between kubernetes and microservices and containers?