Questions tagged [ecma262]

ECMA-262 is a Standard defining the ECMAScript scripting language also known as JavaScript.

ECMA-262 is a Standard defining the ECMAScript scripting language also known as JavaScript. For complete reference read the standard it self at: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

145 questions
3
votes
2 answers

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) { var x = 20; var y = 30; …
Karen Grigoryan
  • 5,234
  • 2
  • 21
  • 35
3
votes
1 answer

JavaScript date constructor and timezone

The Date constructor in JavaScript/ECMAScript/JScript allows passing the number of milliseconds since midnight, 1/1/1970. Nowhere can I find documentation whether this is midnight in the client machine's timezone, or midnight GMT. Which is it? Can…
Brad
  • 1,360
  • 4
  • 18
  • 27
3
votes
1 answer

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, a function contains executable code and state…
Plyto
  • 741
  • 1
  • 9
  • 18
3
votes
4 answers

ActionScript is like JavaScript?

I have a book, Essential ActionScript 3 (O'Reilly), to learn about using that language. It mentions that ActionScript 3 is an implementation of ECMAScript, just like Javascript. I find this strange, because there are many differences. In Javascript,…
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
3
votes
2 answers

Primitive wrapper behavior in JavaScript

In the book Professional Javascript for Web Developers i read that primitive wrappers are used internally by JavaScript when trying to access properties and methods of primitive objects. Does that mean that each time i try to access the length…
dreta
  • 1,016
  • 3
  • 13
  • 22
2
votes
1 answer

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 the lexical grammar; However, in Static Semantics:…
AngryJohn
  • 576
  • 4
  • 10
2
votes
1 answer

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 an IfStatement. my confusion begins with…
AngryJohn
  • 576
  • 4
  • 10
2
votes
3 answers

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 Assignment Operators Evaluation it says that the left side in…
AngryJohn
  • 576
  • 4
  • 10
2
votes
1 answer

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]], [[GlobalObject]] and etc.. But, I can't understand about…
2
votes
1 answer

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 recently I've found an article in the documentation…
Parzh from Ukraine
  • 7,999
  • 3
  • 34
  • 65
2
votes
2 answers

Precedence of function object expression in ECMAScript

In order to implement a tiny compiler that emits ECMAScript I need to know how strong a function object expression binds, i.e. what is the precedence of the "operator" function(a1, a2, ...) { ... }? For example, how is function(a1, a2, ...) { ... }…
Marc
  • 4,327
  • 4
  • 30
  • 46
2
votes
1 answer

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 understand, since string is 6 letters long…
JKirchartz
  • 17,612
  • 7
  • 60
  • 88
2
votes
1 answer

How is a NullLiteral represented in tree form?

According to the ECMAScript specification in section 7.8.1 a NullLiteral is defined as follows: NullLiteral :: null What I am trying to understand is how this is represented in tree form when a NullLiteral is included in the following…
ChaosPandion
  • 77,506
  • 18
  • 119
  • 157
2
votes
1 answer

How can I effectively test a scripting engine?

I have been working on an ECMAScript implementation and I am currently working on polishing up the project. As a part of this, I have been writing tests like the following: [TestMethod] public void ArrayReduceTest() { var engine = new Engine(); …
ChaosPandion
  • 77,506
  • 18
  • 119
  • 157
2
votes
1 answer

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 converted to number, zero-length string is converted to…
yaromir
  • 378
  • 7
  • 17