Created
December 8, 2018 15:34
-
-
Save fotonmoton/865f07322975120c28683c69f73cf369 to your computer and use it in GitHub Desktop.
JavaScriptCore Array.keys() object missing Symbol.iterator method :(
This file contains hidden or 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
//Code: | |
const arr_iterator = Array(100).keys(); | |
const is_iterator = arr_iterator[Symbol.iterator]; | |
const arr = Array.from(arr_iterator); | |
console.log('typeof arr_iterator[Symbol.iterator]: ' + typeof is_iterator); | |
console.log('Array.isArray(arr): ' + Array.isArray(arr)); | |
console.log('arr: ' + JSON.stringify(arr)); | |
/* | |
Logs from android emulator: | |
12-08 17:27:24.107 31835 32034 I ReactNativeJS: typeof arr_iterator[Symbol.iterator]: undefined | |
12-08 17:27:24.107 31835 32034 I ReactNativeJS: Array.isArray(arr): true | |
12-08 17:27:24.107 31835 32034 I ReactNativeJS: arr: [] | |
Logs fron Google Chrome console: | |
App.js:25 typeof arr_iterator[Symbol.iterator]: function | |
App.js:26 Array.isArray(arr): true | |
App.js:27 arr: [0,1,2,3,4,5,6,7,8,9] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment