Copy Code code as follows:
/*
JS Basic Grammar, a few more easily confusing place.
*/
/*
==
===
*/
Function de () {
var ab = 25; Numerical
var ba = "25"; String
if (ab = = ba) {//==, will be converted first, after the pair.
Alert ("B");
}
if (!) ( AB = = ba)) {//=== will not convert, and direct alignment, AB is numeric type data, and BA is string type data
Alert ("a");
}
}
/*
!b
!! B
*/
function dd () {
var b= 1;
if (!! b) {//! when it is not 0 value, so return FALSE, when!! , a further Boolean () method is followed, then the Boolean value is reversed, and the value is obtained.
Alert ("a");
}
}
/*
parseint parsefloat
*/
Function Parse () {
var a = "18px";
var B = parseint (a); return value 18
var C = parseint (A, 10); Return a value of 18, you can pass parameters, the system
alert (b);
alert (c);
var e = "18.2px";
var d = parsefloat (e);
Alert (d)
/*
The difference between parseint and parsefloat is that the first decimal point is not ignored when the value is converted, that is, the number after the first decimal point is preserved, but the second decimal point is ignored.
Parsefloat also ignores the 0 at the first position.
*/
}
Window.onload = function () {
Parse ();
DD ();
De ();
}