MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1function assert(condition, message) {
2 if (!condition) throw new Error(message);
3}
4
5assert(
6 [2201970, 40309, 6267400].join(',') === '2201970,40309,6267400',
7 `expected decimal join output, got ${[2201970, 40309, 6267400].join(',')}`
8);
9
10assert(
11 [999999, 1000000, 1000001].join(',') === '999999,1000000,1000001',
12 `expected plain integers around one million, got ${[999999, 1000000, 1000001].join(',')}`
13);
14
15assert(
16 [2201970].toString() === '2201970',
17 `expected Array#toString to use decimal formatting, got ${[2201970].toString()}`
18);
19
20assert(
21 [1.5, 2201970].join(',') === '1.5,2201970',
22 `expected mixed numeric join output, got ${[1.5, 2201970].join(',')}`
23);
24
25console.log('array join number stringification test passed');