Created
January 29, 2018 05:21
-
-
Save justjavac/bfaac2f36ab52c1fdda1ce156bf27155 to your computer and use it in GitHub Desktop.
对象解构赋值 wtf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let reslt, x; | |
reslt = [...null]; // TypeError: null is not iterable | |
reslt = [...undefined]; // TypeError: undefined is not iterable | |
reslt = {...null}; // {} | |
reslt = {...undefined}; // {} | |
if (x in null) {} | |
// TypeError: Cannot use 'in' operator to search for 'undefined' in null | |
if (x in undefined) {} | |
// TypeError: Cannot use 'in' operator to search for 'undefined' in undefined | |
for (x in null) {} | |
// correct | |
for (x in undefined) {} | |
// correct |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment