<script type="text/javascript">
var firstValue = 5;
var secondValue = "5";
if (firstValue == secondValue) {
document.writeln("They are the same.");
} else {
document.writeln("They are not the same.");
}
if (firstValue === secondValue) {
document.writeln("They are the same.");
} else {
document.writeln("They are not the same.");
}
</script>Javascript 等于判别
最新推荐文章于 2021-10-01 00:07:32 发布
本文通过一个简单的JavaScript脚本示例,介绍了在JavaScript中使用双等号(==)和三等号(===)进行变量比较的区别。展示了当比较的两边分别为数字和字符串时,两种不同比较方式的结果差异。
1633

被折叠的 条评论
为什么被折叠?



