The pit of map in Node.js

const deviceLogMap = new Map([
  [0,""],[1,""][3,"2"]]);

in the map above

[1,""][3,"2"]
The number is missing between

, but there is no error message at run time, and the relevant error message cannot be captured.
ask for answers

Mar.04,2021

this is all discovered by you, the bug of V8.
new Map (wrong_iterable) swallow TypeError in file scripts
https://chromium-review.googl.

< H1 > Supplementary instructions < / H1 >

this bug on Map new Map ([iterable]) , but non-iterating parameters do not throw an error to the debugger, you will find that subsequent code cannot be executed, depending on the V8 used by the nodejs version.


think of [3Jing 'Test 2'] as an array index without a comma.

let a = [1,''];
const deviceLogMap = new Map([
  [0,''],a[3,'2']]);

-Update
= = tested that mine reported an error.


clipboard.png

dare to ask what version of your nodejs is.


this does not count as bug. The syntax of
[1pm 'fortification'] [3pi 'test 2'] is true in itself.
is equivalent to

    const arr = [1,'']
    console.log(arr['2'])
//    => undefined

No problem:)

=
tested that my node also reported an error emmm.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb3a76-471b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb3a76-471b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?