Questions tagged [ecmascript]
ECMAScript is the scripting language standardized by Ecma International in the ECMA-262 specification and ISO/IEC 16262.
30 questions
1
vote
2
answers
321
views
Variable assignment in ECMAScript specification in detail
I am trying to wrap my head around what the ECMAScript specification suggests about variable assignment.
Introduction:
Coming from Java, this is pretty straight forward. Variables get stored at a ...
0
votes
2
answers
544
views
ECMAScript Primitives: Immutability vs Value Type
Coming from languages like C++, Java or PHP I've learned that there are Value Types and Reference Types. Value Types store values directly in the variable (in a box / memory location). Whereas ...
0
votes
2
answers
218
views
ECMAScript specification of primitives and objects
When reading through the ECMAScript specification, I noticed, it actually never mentions concepts like "pass by value" or "pass by reference".
When looking at the assignment ...
6
votes
2
answers
591
views
Is "this" in JavaScript out of fashion?
I'm not a frontend dev, but I recall that a few years ago, the this keyword was commonplace in frontend codebases.
In recent years, I haven't seen this get used anymore. In the last few frontend ...
3
votes
1
answer
576
views
What is the role of ISO in the ECMAScript standardization process?
I've been told on StackOverflow this questions was off-topic so I'm asking here:
From this webpage (ISO/IEC 22275:2018):
This International Standard defines the ECMAScript Specification Suite ...
2
votes
1
answer
96
views
Design Pattern to implement a settable JavaScript Module variable
I am writing a client to talk to a server API in JavaScript. I have an OOP background but am trying to embrace modern EcmaScript.
So I started with this:
customerApi.js:
const baseUrl = "http://...
0
votes
0
answers
154
views
Promise, Ecmascript and Whatwg event loop
I've recently learned that setTimeout is not part of Ecma 262 standard but takes part of WhatWG one.
I have one misunderstanding concerning these two standards and I can't get how they converge.
For ...
4
votes
2
answers
4k
views
Is it conventional to use both await and .then()?
I've written a bit of code that looks like this:
async function fetchData() {
const json = await fetch(ENDPOINT + key.key).then(data => data.json());
//Do something with the data
}
It's ...
3
votes
1
answer
848
views
NodeJS (ES6): Design Pattern with bind usage
The question is related to the resolution of the this operator in Javascript classes. NodeJS now supports ES6 classes. The problem faced during this is that when a new instance of the class is created ...
1
vote
1
answer
93
views
Accessing properties of composited classes without breaking encapsulation
We've built a class that allows you to easily draw stuff on a <canvas> element.
That class is called Canvas. I've encapsulated the <canvas> element and the class itself in a WebComponent, ...
1
vote
2
answers
104
views
Literal assignment in ECMAScript 2017 Specification
I am trying to build a derivation tree for the program
x = 42
using the specification for ECMAScript 2017. I see that there there is an AssignmentExpression which has the production rule:
...
0
votes
1
answer
1k
views
ES6 and OO Desighn: It is good idea to use a class as "Interface"?
Usually on Php or in Java and in other single Inheritance Object Oriented Languages, when I am writing a software I use and Interface then and afterwards I implement the class that implements the ...
3
votes
1
answer
604
views
Javascript / Ecmascript language grammar disambiguation
I'm working on the design of a compiler for a language in which I have to use curly brace for two different purposes. I am currently stuck in writing a non-ambiguous grammar but I realized that some ...
26
votes
1
answer
4k
views
Are generator functions valid in functional programming?
The questions are:
Do generators break the functional programming paradigm? Why or why not?
If yes, can generators be used in functional programming and how?
Consider the following:
function * ...
16
votes
3
answers
5k
views
Why can't an ES2015 WeakMap have primitive keys?
There are six primitive data types in JavaScript:
Boolean, Number, String, Symbol, undefined, null
A WeakMap can't have primitive data types as keys. And a WeakSet can't have primitive values.
Why ...