-1
使用JavaScript's bitwise1或等於運算符|=
創建polyfills是否有任何問題?Javascript使用按位或等於操作符| =爲polyfill創建?
Date.now |= function() {
return +new Date;
};
1Bitwise operator reference
2Date.now()
reference
使用JavaScript's bitwise1或等於運算符|=
創建polyfills是否有任何問題?Javascript使用按位或等於操作符| =爲polyfill創建?
Date.now |= function() {
return +new Date;
};
1Bitwise operator reference
2Date.now()
reference
嗯,是嗎?有|
和||
之間的主要區別,以及polyfills應該使用:
Date.now = Date.now || function() {return +new Date;};
畢竟,如果你用這樣的:
Date.now = Date.now | function() {return +new Date;};
你會得到的結果0
覆蓋功能。
我很高興我問! :) 謝謝! – 2013-03-16 03:36:44
你甚至嘗試過嗎? – tjameson 2013-03-16 03:27:42
是的,它沒有工作。 – some 2013-03-16 03:28:20