+ 5

iterator value undefined is not an entry object

I was trying to use Map in this code : https://code.sololearn.com/WzIQsLiSr1mI/?ref=app When I created a small map with about 6 entries it worked but when I added more records it gave me an error. `Uncaught TypeError: iterator value undefined is not an entry object` Is this limit of Map constructor? or something else? any way to fix this? or should I use an object literal as Map like let obj={ key:val, key2:val2, }; //like this.? Thanks.

16th Dec 2019, 5:52 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
5 Antworten
+ 2
🇮🇳Omkar🕉 It's working. Check line no 31 . You didn't add , and remove , from line no 49
16th Dec 2019, 6:15 AM
A͢J
A͢J - avatar
16th Dec 2019, 6:17 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 4
🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! , I probably didn't read you're answer completely or you edited it afterwards. not sure. "and remove , from line no 49" ~🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! comma at end (trailing comma) will not give any errors. it's for convenience of adding new records, elements etc. ●Trailing comma: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas
16th Dec 2019, 6:25 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
🇮🇳Omkar🕉 It happen in long code 😂
16th Dec 2019, 6:19 AM
A͢J
A͢J - avatar
+ 2
🇮🇳Omkar🕉 I know that extra comma will not give any error but it will create empty object which is not necessary.
16th Dec 2019, 7:38 AM
A͢J
A͢J - avatar