ECMA is a standards organisation
Questions tagged [ecma]
178 questions
134
votes
4 answers
How to wait for a JavaScript Promise to resolve before resuming function?
I'm doing some unit testing. The test framework loads a page into an iFrame and then runs assertions against that page. Before each test begins, I create a Promise which sets the iFrame's onload event to call resolve(), sets the iFrame's src, and…
![](../../users/profiles/3120446.webp)
dx_over_dt
- 8,418
- 13
- 39
- 65
47
votes
2 answers
Why is `(foo) = "bar"` legal in JavaScript?
In Node.js's REPL (tested in SpiderMonkey as well) the sequence
var foo = null;
(foo) = "bar";
is valid, with foo subsequently equal to "bar" as opposed to null.
This seems counterintuitive because one would think the parenthesis would at least…
![](../../users/profiles/877165.webp)
TERMtm
- 1,773
- 3
- 21
- 27
35
votes
2 answers
Which Edition of ECMA-262 Does Google Apps Script Support?
According to this thread from the old Google Group, Apps Script is based on ECMA-262 3rd Edition.
This would seem to be supported by the fact that auto-completion in the editor displays 3rd Edition array functions.
However the following code runs…
![](../../users/profiles/1279033.webp)
chrisbateskeegan
- 953
- 1
- 10
- 13
33
votes
4 answers
When to NOT use "strict mode" in javascript?
I've found this post-What does "use strict" do in JavaScript, and what is the reasoning behind it?
And what I'm understanding here is that I should use strict always.
But I wonder, if it was true, that always is better to use "strict mode", then It…
![](../../users/profiles/3100462.webp)
Ramon Marques
- 2,468
- 1
- 20
- 31
17
votes
2 answers
NFC standards (NFC Forum, ISO/IEC, ECMA
I am often being asked about standards, the NFC is based on. I summarized my knowledge in the text below. I hope it can be an answer to such questions. Please feel free to correct it by posting comments and replies - I will include it into my…
![](../../users/profiles/384115.webp)
STeN
- 6,172
- 21
- 75
- 121
11
votes
2 answers
Webpack generates arrow function in ES5
I want to use TypeScript modules and bundle them via Webpack. Here are my config files:
webpack.config.js:
const path = require('path');
module.exports = () => {
return {
entry: './index.ts',
output: {
filename:…
![](../../users/profiles/13601052.webp)
Ivan Adanenko
- 325
- 1
- 9
9
votes
1 answer
How do I get Istanbul to recognize code coverage when using ESM?
I'm using ESM to loading my modules and I use them in this way:
// More info on why this is needed see (https://github.com/mochajs/mocha/issues/3006)
async function wire(){
await import("./Sanity.spec.mjs");
await…
![](../../users/profiles/9335205.webp)
JGleason
- 1,612
- 1
- 10
- 31
8
votes
1 answer
Why String.prototype.substr() seems to be deprecated?
It is mentionned on the ECMAScript standard here that :
... These features are not considered part of the core ECMAScript
language. Programmers should not use or assume the existence of these
features and behaviours when writing new ECMAScript…
![](../../users/profiles/3614478.webp)
ElJackiste
- 1,914
- 2
- 17
- 28
7
votes
1 answer
Why does Promise.all() tigger Array.prototype.then if defined?
Having the following pice of code...
const array = [
Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)
];
Array.prototype.then = function () {
console.log('Why does this gets triggered?');
}
Promise.all(array)
.then(result =>…
![](../../users/profiles/6111342.webp)
Iván Sánchez
- 812
- 12
- 25
7
votes
4 answers
How to get a leading '+' for positive numbers in Intl.NumberFormat?
I'm using Intl.NumberFormat to convert a number type to a formatted string in typescript/javascript in Angular2. I want a native solution and this is ideal, but I need a leading plus sign to be included for positive numbers.
If this is not possible…
![](../../users/profiles/4153059.webp)
CodeCabbie
- 2,136
- 1
- 12
- 27
7
votes
1 answer
Why is there no ISO or ECMA standardization for C# later than 2.0?
I have started learning C# and was looking for a standard specification, but found that C# versions greater than 2.0 were not standardized by ISO or ECMA (or so I gathered from Wikipedia). Is there any reason for this?
![](../../users/profiles/1063194.webp)
ZoomIn
- 1,040
- 13
- 31
6
votes
0 answers
When parsing a string in Chrome, why does new Date() treat "YYYY-MM-DD" differently?
I found an interesting quirk in Chrome when parsing strings as dates. These strings parse the same way:
new Date("2020 01 01")
=> Wed Jan 01 2020 00:00:00 GMT-0500 (GMT-05:00)
new Date("2020-01 01")
=> Wed Jan 01 2020 00:00:00 GMT-0500…
![](../../users/profiles/1712751.webp)
Benjamin
- 1,020
- 11
- 16
6
votes
1 answer
How do I find the latest Typescript target support for any version of node?
Assuming any version of Node, how do I find the corresponding Typescript Compiler Option for target that gives most the functionality? I want to remove the guest work.
Specify ECMAScript target version: "ES3" (default), "ES5", "ES6"/"ES2015",…
![](../../users/profiles/124486.webp)
user157251
- 64,489
- 38
- 208
- 350
6
votes
1 answer
Why does JSON encode UTF-16 surrogate pairs instead of Unicode code points directly?
To escape a code point that is not in the Basic Multilingual Plane, the character is represented as a twelve-character sequence, encoding the UTF-16 surrogate pair. So for example, a string containing only the G clef character (U+1D11E) may be…
![](../../users/profiles/209139.webp)
TRiG
- 9,249
- 6
- 50
- 101
5
votes
1 answer
What are the ISO 2375 and 2735 standards mentioned in the ECMA-119 specification?
Out of ECMA-119 specification:
8.5 Supplementary Volume Descriptor
...
8.5.3 Volume Flags (BP 8):
The bits of this field shall be numbered from 0 to 7 starting with the least significant bit.
This field shall specify certain characteristics of…
![](../../users/profiles/484030.webp)
schwer
- 123
- 7