How to avoid unwanted keystrokes from number to line in Immutable.js

I am trying to use Immutable in a project with reactions and flow.

Say I have a .js file with code

console.log ( Immutable.Map({1: 2}).toString() )

I am viewing this script and running it from a browser (Google Chrome), the result is:

"Map { "1": 2 }"

note that the key, 1, is now a string, not a number.

If I try the same code directly in the console of the site http://facebook.imtqy.com/immutable-js/ , I get the correct result:

"Map { 1: 2 }"

Why is this happening and what can I do to get the correct result (key as number) in my script?

I am using node v0.10.26, Browserify 5.12.0 and immutable 3.7.1

+4
1

, , :

> Immutable.Map([[1, 2]]).toString()
'Map { 1: 2 }'

. https://facebook.imtqy.com/immutable-js/docs/#/Map/Map

+5

All Articles