当前位置:网站首页>JS indexof() always returns -1
JS indexof() always returns -1
2022-06-25 11:42:00 【Duxiaolie】
Problem description :
Use indexOf() Determine whether a value is in Js in . When you try , This number is just js Array , But always return -1.
Cause analysis :
Consider whether the type is correct .
Solution :
Number( Numeric variable );
for example :
var idCar = ‘3’;
var value = indexOf(idCar);
console.log(value);
if(value != -1){
alert(“ The ID card already exists ”);
}
边栏推荐
- Under what circumstances will Flink combine operator chains to form operator chains?
- Double buffer transparent encryption and decryption driven course paper + project source code based on minifilter framework
- Is it safe to open a stock account on your mobile phone? Who can I open an account with?
- Big endian and little endian
- Problems encountered using easyexcel
- Big Endian 和 Little Endian
- Spark history server performance improvement (I) -- Application List
- ThingsPanel 发布物联网手机客户端(多图)
- Flink partition policy
- Record the process of submitting code to openharmony once
猜你喜欢

Solution to the timeout scenario of Flink streaming computing (official live broadcast)

寿命分布 4种

Idea uses the fast request interface for debugging

Yisheng biological sprint scientific innovation board: 25% of the revenue comes from the sales of new crown products, and it is planned to raise 1.1 billion yuan

Database Series: MySQL index optimization summary (comprehensive version)

为什么要分布式 id ?分布式 id 生成方案有哪些?

Countdownlatch source code analysis

Introduction to JVM principle

Capacity expansion mechanism of Dict Of redis (rehash)

牛客网:分糖果问题
随机推荐
Is it safe to open a stock account on your mobile phone? Who can I open an account with?
Leetcode 1249. Remove invalid brackets (awesome, finally made)
JVM shutdown hook details
Under what circumstances will Flink combine operator chains to form operator chains?
记一次给OpenHarmony提交代码的过程
Hangzhou / Beijing neitui Ali Dharma academy recruits academic interns in visual generation (talent plan)
Niuke: rotation array
Comparable的使用(用于Arrays.sort)
寿命分布 4种
Big Endian 和 Little Endian
Thingpanel publie le client mobile IOT (Multi - images)
redis的dict的扩容机制(rehash)
Multiple clicks of the button result in results
Countdownlatch source code analysis
Data Lake survey
TCP如何處理三次握手和四次揮手期間的异常
Shichuang Energy sprint Technology Innovation Board: le chiffre d'affaires annuel prévu de 1,1 milliard de RMB est de 0,7 milliard de RMB, en baisse de 36%
Design and implementation of university laboratory goods management information system based on SSH
Kingbasees plug-in DBMS of Jincang database_ RANDOM
Ladder side tuning: the "wall ladder" of the pre training model