Open wuyongyu opened 6 years ago
好的代码编辑图片网站:https://carbon.now.sh/
看了React源码
记得后台管理有缓存问题,去查明原因吧 小火汁
解说react好的网站:https://www.yanshuo.me/p/67112
比如:
isNaN(NaN); // true
isNaN(undefined); // true
isNaN({}); // true
function isReallyNaN(x){
return x !== x;
}
0.1 + 0.2; // 0.30000000000000004
(0.1 + 0.2) + 0.3; // 0.6000000000000001
0.1 + (0.2 + 0.3); // 0.6
所以平时尽可能地采用整数值运算
12 & 1 // 0
23 & 1 // 1
【常用于if语句】,这种写法可读性不高
this.foo = ::this.foo;
this.foo = this.foo.bind(this);
【两个冒号的::操作符叫做 bind 操作符】
Erlang 语言的作者 Joe Armstrong 说,面向对象语言的问题是,它们永远都要随身携带那些隐式的环境。你只需要一个香蕉,但却得到一个拿着香蕉的大猩猩...以及整个丛林
$$typeof
有什么作用?$$typeof: Symbol.for(‘react.element’)
用来解决安全问题。防止 XSS 注入,采用 symbol 方式,在判断是否合法的 element 时,检查 $$typeof
属性0xeac7
?// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var TYPE_SYMBOL = (typeof Symbol === 'function' && Symbol.for &&
Symbol.for('react.element')) || 0xeac7;
React
:laughing: 参考链接正确答案: script start async1 start async2 promise1 script end async1 end promise2 undefined setTimeout
// 斐波那契函数
===
(0.8 + 0.7 + 0.6 + 0.9) / 4 // 0.75 (0.6 + 0.8 + 0.7 + 0.9) / 4 // 0.7499999999999999
(6 + 8 + 7 + 9) / 4 // 7.5 (8 + 7 + 6 + 9) / 4 // 7.5