148
questions
0
votes
4
answers
225
views
How to feature test for BigInt support?
I'm not familiar with modern JS and tooling to even try something.
References:
https://github.com/tc39/proposal-bigint
1
vote
1
answer
175
views
Am I right about LexicalEnvironment and VariableEnvironment?
I read a lot of articles, I was very confused, I also read the ES6 official documentation.
When creating an execution context, LE and VE initially point to the same Lexical Environment. But then the ...
1
vote
1
answer
58
views
Understanding ECMAScript production parameterized annotations
I have been reading about how regular expressions are parsed in JS in this link: https://262.ecma-international.org/13.0/#sec-regular-expressions, but I don't quite understand what are the ...
4
votes
2
answers
617
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
120
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
56
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
1
answer
135
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
108
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 ...
1
vote
2
answers
50
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
187
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
56
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
161
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
202
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 ...
2
votes
3
answers
282
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
68
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 ?
1
vote
0
answers
126
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 ...
-2
votes
1
answer
77
views
in javascript, timer is not a part of Ecma Standard?
is timer not a part of Ecma Standard? for example
setTimeout, setInterval
1
vote
0
answers
205
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 ...
2
votes
4
answers
7k
views
Why BigInt demand explicit conversion from Number?
BigInt and Number conversions
When working with numbers in JavaScript there are two primitive types to choose from - BigInt and Number. One could expect implicit conversion from "smaller" ...
0
votes
2
answers
191
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
98
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 ...
148
votes
4
answers
149k
views
How to convert BigInt to Number in JavaScript?
I found myself in the situation where I wanted to convert a BigInt value to a Number value. Knowing that my value is a safe integer, how can I convert it?
2
votes
1
answer
235
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
44
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
20
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
250
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 ...
2
votes
1
answer
403
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
215
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:
...
4
votes
1
answer
3k
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
363
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
123
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
647
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
168
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
65
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
433
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
3k
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
221
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
146
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
63
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
1k
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
67
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
230
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
3k
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
560
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
353
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 ...
12
votes
3
answers
11k
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
850
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
162
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
219
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,...