ioquatix / script-runner

This package will run various script files inside of Atom. It currently supports JavaScript, CoffeeScript, Ruby, and Python. You can add more.
http://atom.io/packages/script-runner
Other
62 stars 23 forks source link

Javascript Number.prototype.toLocaleString() method giving incorrectly formatted result when run inside atom with script-runner package #96

Closed rohan-paul closed 6 years ago

rohan-paul commented 6 years ago

Steps to Reproduce:

The below code gives me "123,456.789" where as the correct ouput should be "1,23,456.789"

var number = 123456.789;

// India uses thousands/lakh/crore separators
console.log(number.toLocaleString('en-IN'));  // => 12,345,678.896

While, in Chrome-Developer console the same code is producing correct (expected) result

Per below documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString

here's the correct ouput :

image

ioquatix commented 6 years ago

I can reproduce this with plain node from a standard terminal:

> var number = 123456.789;
> console.log(number.toLocaleString('en-IN'));  // => 12,345,678.896
123,456.789

Therefore, I don't believe this is a problem with script runner, but a problem with Node, or some other part of the JS ecosystem.