I've been wondering about the use of the keyword null
in the JS language. In cases like C/C++, NULL
is stood to mean something like a null pointer, i.e. a pointer to 0 (though there are macro definitions, etc, which can change this), but how is JS specified to handle the keyword? Is there some specification that says how it should be processed?
答案 0 :(得分:0)
null
是javascript中的文字,表示空值或空对象。但是,这不应该与undefined
混淆,==
是未初始化的变量或对象的值。此外,在对null和undefined值使用等于运算符(===
)或标识运算符(typeof null // object (bug in ECMAScript, should be null)
typeof undefined // undefined
null === undefined // false
null == undefined // true
)时,必须始终小心,因为根据使用的运算符,比较会产生完全不同的结果:
if(studentList.get(position).get("absentMarked")==1){
Log.d("Entered","Yes");
viewHolder.sw.setChecked(true);
}else{ viewHolder.sw.setChecked(false); }