We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.可以将字符串显式地转换为数字,例如 + "123" // 123 + "123abc" // NaN 2.可以将日期对象强制转换为数字,返回结果为时间戳,例如 + new Date() // 1523021852154 // 上述代码等价为以下代码 new Date().getTime() // 1523021852154 // 或者 Date.now() // 1523021852154
+ "123" // 123
+ "123abc" // NaN
+ new Date() // 1523021852154
// 上述代码等价为以下代码
new Date().getTime() // 1523021852154
// 或者
Date.now() // 1523021852154
在js中,&&和||运算符的返回值并不一定是布尔类型,而是两个操作树其中一个的值。例如: var a = 42; var b = "abc"; var c = null;
var a = 42;
var b = "abc";
var c = null;
a || b; // 42 a && b; // "abc"
a || b; // 42
a && b; // "abc"
c || b; // "abc" c && b; // null
c || b; // "abc"
c && b; // null
null == undefined; // true
The text was updated successfully, but these errors were encountered:
No branches or pull requests
+运算符的使用
1.可以将字符串显式地转换为数字,例如
+ "123" // 123
+ "123abc" // NaN
2.可以将日期对象强制转换为数字,返回结果为时间戳,例如
+ new Date() // 1523021852154
// 上述代码等价为以下代码
new Date().getTime() // 1523021852154
// 或者
Date.now() // 1523021852154
假值
逻辑运算符&&与||
在js中,&&和||运算符的返回值并不一定是布尔类型,而是两个操作树其中一个的值。例如:
var a = 42;
var b = "abc";
var c = null;
a || b; // 42
a && b; // "abc"
c || b; // "abc"
c && b; // null
null和undefined之间的想等比较
null == undefined; // true
The text was updated successfully, but these errors were encountered: