Map() is not defined in Google Chrome

前端 未结 4 508
暗喜
暗喜 2021-01-13 03:18

I\'ve been searching for an answer but I\'m only getting results regarding the Google maps API. I\'m trying to use a map in JavaScript to map an integer to a string. Everyth

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-13 03:41

    Some ES harmony features, including Map(), did already exist in Chrome at the end of 2011. It's just disabled by default.

    To enable the feature, visit chrome://flags/, and enable "Enable experimental JavaScript". Then restart the browser and enjoy the new features.

    An alternative method is to pass the --js-flags=--harmony flag on the command line. For instance:

    chromium --js-flags=--harmony
    chrome.exe --jsflags=--harmony
    

提交回复
热议问题