Questions tagged [ecma262]
ECMA-262 is a Standard defining the ECMAScript scripting language also known as JavaScript.
145
questions
3
votes
2
answers
109
views
BigInt and Number coercion by numeric comparison operators
Will numeric comparison, between a BigInt and a Number, coerce one argument to BigInt, or coerce one argument to Number?
For example, in the following, is 3n coerced to 3, or is 1 coerced to 1n?
...
5
votes
2
answers
100
views
What is the purpose of classScope in the EcmaScript specification?
I was reading the steps in the specification (12th edition) that occur when a class declaration or expression is used, and saw that it starts off by creating a class scope at section 15.7.7 Runtime ...
-2
votes
1
answer
47
views
How do I build a Regexp that doesn't care about positions
I'm making a Scrabble game with HTML and Javascript and I'd like to add a "hint word" feature based on the player's rack.
I have a dictionary array with the valid words, and I need to test ...
0
votes
0
answers
24
views
LexicallyScopedDeclarations operation doesn't make sense
let's assume we have a function and inside that function, we have a let declaration at the topmost level of the function.
now we run FunctionDeclarationInstantiation, but here comes the weird part, ...
0
votes
1
answer
42
views
Javascript Environment Record, is it an Exotic Object?
Are the environment record and exotic object creation procedures the same?
i.e. creation of a basic object with different internal slots and methods, than that of an ordinary object?
Are both objects ...
2
votes
1
answer
82
views
Is there a mistake in ECMAScript spec relating to Unicode code points?
In The Syntactic Grammar it says that
When a stream of code points is to be parsed as an ECMAScript Script or Module, it is first converted to a stream of input elements by repeated application of ...
0
votes
0
answers
58
views
about ECMAScript Parse Nodes
i wanted to verify my understanding of the "Parse node" in the ECMA-262 spec.
so whenever an ECMAScript program starts, it goes through the lexical grammar phase which basically convert the ...
1
vote
2
answers
34
views
What is the meaning of an alternative according to ecma262?
I've been wondering what's the meaning of "alternative" in ecma262.
i've seen that the term "alternative" was used many times in the spec.
here are some examples:
quote taken from ...
1
vote
0
answers
133
views
How the evaluate operation works in ecmascript?
i've been wondering how the Evaluate operation works in ecmascript.
so i've been learning about context-free grammer but i couldn't understand the exact steps when we evaluate a non-terminal symbol on ...
1
vote
1
answer
47
views
Which nonterminal is the start symbol?
While i was reading the spec(ECMAScript 2022) i've wondered which nonterminal symbol is the start symbol ?
in other words the first place that is being evaluated in ECMAScript 2022
1
vote
2
answers
76
views
function declarations cannot be inside an if statement according to ecmascript
how is it even possible to declare a function inside an IfStatement ? because according to the ecmascript spec only a Statement can be there.
if ( Expression ) Statement
if ( Expression ) Statement ...
2
votes
1
answer
169
views
confusion in ecmascript productions
I've been confused lately about productions in ecma262 spec.
There are productions based on my assumption that can be other productions.
for example, Statement
Statement can be a Block it can also be ...
1
vote
3
answers
138
views
assignment expression in ecma262
consider the following code
var myVar = 'Hola';
{
let myVar;
myVar = 'Hello'
}
on line 4(myVar = 'Hello') we are using the Assignment operator
Now when i was looking at ecma262 in ...
1
vote
1
answer
47
views
can someone explain to me what FunctionDeclarationInstantiation does according to ecma262?
i've been reading the ECMAScript spec(ecma262) quite a bit lately.
and i find the FunctionDeclarationInstantiation abstract operation to be complicated.
can someone explain to me what it does ?
0
votes
0
answers
45
views
What is the "list-separator String appropriate for the host environment’s current locale" in JavaScript (ECMAScript)
While reading the ECMAScript 2015 Language Specification, I came across the following step in the Array.prototype.toLocaleString method:
Let separator be the String value for the list-separator ...
1
vote
0
answers
164
views
What does “a relation is least” mean?
In the ECMAScript spec, it says:
A Relation is least with respect to some conditions when it is the smallest Relation that satisfies those conditions.
To be honest, I do not really understand the ...
0
votes
2
answers
156
views
What's the principle of Array.apply(null, obj)?
let a = {0: 'a', 1: 'b', length: 2}
Array.apply(null, a) // ['a', 'b']
Using the Array constructor is the fastest way to convert an Array-like Object to Array e.g. jsperf
I want to figure out how it ...
1
vote
0
answers
75
views
Is this valid automatic semicolon insertion?
I've been fiddling with JavaScript, and I found some behavior I don't understand. The problem seems to be with automatic semicolon insertion (ASI), but, to me, it looks like ASI is misbehaving. The ...
2
votes
1
answer
202
views
ECMAScript 2017, I can't understand Realm.[[TemplateMap]]
I'm writing some article that about ECMA-262's realm in korean(actually there is no article about realm). So, I read ECMA-262 about realm record.and i can understand about [[Intrinsics]], [[...
0
votes
1
answer
39
views
Regex not capturing repeating optional captures
I'm trying to write a URL rewrite regex for my company's site. The URL will always start with category/.+ After that, there can be up to 5 extra tags added on. With my current regex, it always ...
1
vote
0
answers
19
views
Is a decimal digit after the '\' symbol in string allowed in ECMA-262 strict mode? [duplicate]
According to the 6th edition of the ECMA-262 specification in strict mode in single or double quoted strings after '\' it is possible to have EscapeSequence or LineTerminatorSequence and ...
3
votes
1
answer
219
views
Is '\0' followed by a decimal digit in string allowed in ECMA-262 strict mode?
According to the ECMA-262 specification (6th edition) in strict mode in single or double quoted strings after '\' it is possible to have EscapeSequence or LineTerminatorSequence, and EscapeSequence ...
1
vote
1
answer
304
views
What exactly `Function.prototype.length` means?
There was a Function.prototype.arity property purposed for getting number of arguments function expects. Now it is obsolete (since JS 1.4), and the same goal has Function.prototype.length.
But ...
1
vote
1
answer
169
views
What's the difference between VarDeclaredNames and VarScopedDeclarations?
I'm reading EcmaScript specification.
At 9.2.12, there are:
11.Let varNames be the VarDeclaredNames of code.
12.Let varDeclarations be the VarScopedDeclarations of code.
And at 13.1.5 and 13.1.6:
...
3
votes
1
answer
2k
views
Check if object is a constructor - IsConstructor
I want to check if a JavaScript value is a constructor, that is, if it has a [[Construct]] internal method.
ECMAScript defines IsConstructor, which does exactly this, but it's an internal operation.
...
-1
votes
2
answers
198
views
Is there a specific reason why javascript has no isEqual() native function to compare Objects?
The object1 == object2 operation checks to see if the references are the same.
A lot of times we want to check if the objects structure (properties, values and even methods) are the same. We have to ...
1
vote
0
answers
45
views
Is Firefox technically correct in function hoisting within if statements with latest ECMA? [duplicate]
I learned that the following does not work in FF and does in every other standard browser.
if(jQuery){
importantScript();
function importantScript(){
console.log("this is important")...
2
votes
1
answer
109
views
Why does '' (empty string) permeate all strings?
I just ran into a bit of confusion today, "string".indexOf(''); always returns 0, but I would expect -1 (for false); inversely, "string".lastIndexOf(''); always returns 6
lastIndexOf is easier to ...
0
votes
1
answer
528
views
Implementation of setInterval() and setTimeout() under ECMAScript 262
It seems that ECMA Script does not support timed code executions like setInterval().Is there any work around for this?
I thought of using a while true loop but it does not have a facility to wait for ...
4
votes
1
answer
118
views
Where is the immutable binding record of the identifier in a named function expression stored in JavaScript?
Recently I ran into some interesting facts about named function expressions (NFE). I understand that the function name of an NFE can be accessed within the function body, which makes recursion more ...
7
votes
0
answers
62
views
One-line "<!--" comments in JavaScript and ECMAScript [duplicate]
In the previous century, there was a popular "hack" to hide JavaScript from non-JavaScript-enabled browsers:
<script type = "text/javascript">
<!--
alert("Hello, World!");
// --&...
1
vote
1
answer
404
views
getOwnPropertyNames ignores __proto__ on Firefox
__proto__ is a property of Object.prototype:
Object.prototype.hasOwnProperty('__proto__'); // true
However, getOwnPropertyNames ignores it on Firefox:
Object.getOwnPropertyNames(Object.prototype)....
8
votes
1
answer
1k
views
Why is this configurable property not deletable?
Configurable properties seem to be deletable:
var o = {};
Object.defineProperty(o, 'prop', {
configurable: true,
value: 'val'
});
delete o.prop; // true
o.prop; // undefined
But it ...
0
votes
1
answer
189
views
ActionScript this inside nested function
ActionScript 3 language specification states:
In ECMA-262 edition 3, when this appears in a nested function, it is bound to the global object if the function is called lexically, without an ...
2
votes
1
answer
127
views
How JavaScript's (0 == "") === true agrees with ECMA-262 type conversion rules?
I've already seen several questions explaining why 0 == "" is true in JavaScript, but i have a bit deeper question.
So the answer to why is 0 == "" is true in JavaScript is that string "" gets ...
0
votes
1
answer
60
views
What means >>> character in javascript [duplicate]
Today i reading some article on MDN and find something new to me.in this link on line 11 i find some thing like this :
var t = Object( this ), len = t.length >>> 0, k = 0, value;
the full ...
8
votes
1
answer
827
views
Is \0 ("\\0" in a C-style regex string) a valid escape sequence in C++ regular expressions?
NOTE: When I say the regex [\0] I mean the regex [\0] (not contained in a C-style string, which would then be "[\\0]"). If I haven't put quotes around it, it's not a C-style string, and the ...
3
votes
2
answers
64
views
Some complex behaviour with 'with' statement and call
var a = ({
x: 10,
foo: function () {
function bar() {
console.log(x);
console.log(y);
console.log(this.x);
}
with (this) {
...
1
vote
1
answer
206
views
How to configure NSRegularExpression to be compatible with ECMA-262
I need to be ECMA-262 regex compliant and NSRegularExpression is ICU regex compliant. According to Wikipedia, there are a few difference between the two. - are there any NSRegularExpression ...
5
votes
1
answer
2k
views
What is a "calling context?"
ECMA-262 5.1 subsections 10.4.2 and 10.4.2.1 refer to a "calling context." This doesn't appear to be described anywhere else in the document.
Quoting the spec, emphasis mine:
10.4.2 ...
5
votes
2
answers
504
views
ECMA-262 ReturnIfAbrupt
Recently, I read the ECMAScript Language Specification. I didn't plan to read the whole specification, I just picked up some parts. I came cross many questions, one of them is like this:
ToLength
1....
1
vote
1
answer
298
views
ignore sub-pattern matching notation in c++11
On page 1056 in the 4th edition of The C++ Programming language, Stroustrup says the ignoring sub-patterns token is (?, however in boost::regex it is (?:. I suspect Stroustrup might be wrong, can ...
11
votes
2
answers
8k
views
Is there a tool to validate ECMAScript and confirm it is compatible with ECMAScript Language Specification 3rd edition?
I am currently trying to figure out why JSDT posts errors like 'JavaScript error on valid regex'.
While I was testing I realized that it works fine for simple files like this:
var a = {
...
4
votes
1
answer
783
views
Push and pop on a frozen array in Chrome not throwing an exception
The following code does not seem to run as expected under Chrome, and runs differently in Firefox.
(function () {
'use strict';
var
arr = Object.freeze([1, 2, 3]);
try {
arr.push(4);
} ...
0
votes
0
answers
154
views
fix error when passing string xyz-009 into javascript function
So I am passing a string into a javascript function. for example:
function dothis(x,y,z){
something
}
dothis(year,month,contract); // contract = "A10-009_xyz"
I know this has something to do ...
3
votes
1
answer
171
views
ECMAScript function specification
(Sorry if it is answered elsewhere)
I was reading ECMAScript 262 Specification (ECMAScript 5th Edition),
and in 4.3.24 on function it says the following:
NOTE: In addition to its named properties,...
1
vote
2
answers
551
views
JavaScript function pointer scope
This is an academic question concerning javascript.
The code segment below takes an array of integers, and returns an array of pointers to functions.
The functions pointed to are suppose to return ...
2
votes
1
answer
386
views
Why is the dollar sign no longer "intended for use only in mechanically generated code?"
In ECMA-262, 3rd edition[PDF], under section 7.6 ("Identifiers," page 26), we see the following note:
The dollar sign is intended for use only in mechanically generated code.
That seems reasonable....
1
vote
2
answers
69
views
How does the ECMA Script 5 spec allow successful parses for hex ints greater than 0xFF?
In EMCA262 version 5.1 the definition of a hexadecimal integer literal is: (document page 20, PDF page 32)
HexIntegerLiteral ::
0xHexDigit
...
0
votes
1
answer
819
views
how to generate a vxml tag through adynamic ecma/javascript expression
I am having issues with the following scenario:
my vxml has the following snippet:
<block>
<script src="myscript.es"/>
<audio> <value expr="temp()"/> </audio>
<...