当前位置:网站首页>Interesting JS code
Interesting JS code
2022-04-23 08:15:00 【Ling er~】
significant js Code
1. Find all positions of a character in a string
```bash
(function sum (item){
var arr = 'indexhdfhsvfdgdindexbindex'
console.log(item,'item') //index item
var index = arr.indexOf(item)
console.log(index,'index') //0 index
var num = 0
while (index >= 0) {
num++
index = arr.indexOf(item, index + 1)
}
console.log(' Altogether '+num+' Time ') // Altogether 3 Time
})('index')
版权声明
本文为[Ling er~]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230700344140.html
边栏推荐
猜你喜欢

怎么读书读论文

nn.Module类的讲解

Canvas learning Chapter 1
![BUUCTF [极客大挑战 2019]EasySQL1](/img/ad/afca09bc1da003393319af700e90e3.png)
BUUCTF [极客大挑战 2019]EasySQL1

在线YAML转XML工具

mysql查询字符串类型的字段使用数字类型查询时问题

1216_MISRA_C规范学习笔记_控制流的规则要求

Go语学习笔记 - Slice、Map | 从零开始Go语言

Draw a circle quickly in MATLAB (the one that can be drawn directly given the coordinates and radius of the center of the circle)

Briefly describe the hierarchical strategy of memory
随机推荐
Penetration test interview collection -- HVV---
Go语学习笔记 - 语言接口 | 从零开始Go语言
简述存储器的分级策略
访问数据库的时候出现错误 Operation not allowed for a result set of type ResultSet.TYPE_FORWARD_ONLY.详解
[Effective Go 中文翻译]函数篇
Fibula dynamic programming
谈谈那些基础但不简单的股票数据
Compiling principle questions - with answers
3C裝配中的機械臂運動規劃
Find the largest of 3 strings (no more than 20 characters per string).
LeetCode15. 三数之和
The whole house intelligence bet by the giant is driving the "self revolution" of Hisense, Huawei and Xiaomi
LeetCode简单题之重新排列日志文件
Depth of binary tree
dmp引擎工作总结(2021,光剑)
Principle of sentinel integrating Nacos to update data dynamically
编译原理题-带答案
Canvas learning Chapter 1
mysql查询字符串类型的字段使用数字类型查询时问题
Implementation of new