Home > Web Front-end > JS Tutorial > body text

Detailed explanation of JavaScript string judgment method

高洛峰
Release: 2017-03-12 13:05:26
Original
1174 people have browsed it

The main judgment symbols in

Javascript are: ==,! =、===、! ==

==、! =These two symbols will first convert the variabletype before judging. If the types are the same, the values ​​will be compared;

===,! == This is to directly judge the types of two variables. If the types are inconsistent, the judgment will be made directly without comparing the values.

demo:

function bijiao(){

var str="123";

var num=123;

var char='123';

alert(srt==num);//true

alert(str==char);//true

alert(str= ==num);//false

 alert(str!==num);//true

}

The above is the detailed content of Detailed explanation of JavaScript string judgment method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!