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
324
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
548
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
220
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
584
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
851
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
94
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 ...
0
votes
0
answers
267
views
Why doesn't Object.prototype.toString produce more meaningful output?
Why doesn't Object.prototype.toString return a string representation of an object? I don't see any use for the current output and it seems that it would be more useful for the toString function to be ...
1
vote
1
answer
325
views
Template Literals (ECMAScript 2015 6th edition), are they worth it?
I recently found out about JavaScript's Template Literals, and they help a lot with readability. But would it be worth changing my code from now on to these Template Literals, or should I keep using ...
6
votes
1
answer
2k
views
Why is Array.prototype designed to be a fully functional array?
In the below visualisation,
There are two array objects(cars & bikes) that are created with below syntax,
var cars = new Array("Saab", "Volvo", "BMW");
var bikes = ["Honda", "Yamaha"];
whose [[...
6
votes
1
answer
453
views
Will ECMAScript add classes to JavaScript? What does this mean?
I heard that some sort of class system will be added to JavaScript with ECMAScript and I find that a little confusing, because I've just finished reading a JS book, JavaScript, The Good Parts by ...
0
votes
1
answer
320
views
Switching over to the real ES6 / ES2015 [closed]
It is exciting time of having Babel and being able to use all nice nice features. It got me thinking, what happens in the future? Nobody really talks about it. I mean some browsers would eventually ...
49
votes
3
answers
32k
views
Any point in using ES6 Map when keys are all strings?
Plain object keys must be strings, whereas a Map can have keys of any type.
But I have little use for this in practice. In nearly all cases, I find myself using strings as keys anyway. And presumably ...
8
votes
1
answer
343
views
Why create a Global-ish Object.create function?
I'm a fairly experienced programmer in the .NET and Java realms, and I've started reading up on JavaScript. I bought Douglas Crockford's "The Good Parts" book, and I'm immediately put off by a few ...
1
vote
1
answer
489
views
Does ES6 help grow the Ecmascript standard library?
With all the noise about EC6, one thing that I realized I haven't heard about is expanding Javascript's standard library. Javascript has a fairly sparse standard library. You need a 3rd party library ...
5
votes
2
answers
484
views
Is there a name for the number of values a variable can take? [closed]
For example, a bit or a boolean can be either 0 or 1 so the number 2 is associated with it. Similarly, for a byte which is 8 bits, the maximum number of different assignments would be 2^8.
Is there a ...
3
votes
1
answer
627
views
Could it be possible to add the integer type to the ECMAScript standard?
In JavaScript, every number you will ever use will always be represented with what C programmer would call a double. The official type is I believe number. If I recall correctly, that fact was ...
0
votes
1
answer
931
views
In what way is JavaScript (ECMAScript) similar to Self and Scheme
When looking at the ECMAScript 4th Edition specification here it mentions that
ES3 is a simple, highly dynamic, object-based language that takes its major ideas from the languages Self and Scheme.
...
4
votes
1
answer
479
views
what will EcmaScript 6 bring to the table for us [closed]
Our company ported moderate chunks of business logic to JavaScript. We compile the code with a minifier, which further improves performance. Since the language is dynamically typed, it lends itself ...
98
votes
2
answers
7k
views
What is JavaScript, really?
All this started when I was looking for a way to test my webpage for JavaScript conformance like the W3C HTML Validator. I have not found one yet. So let me know if you know of any...
I looked for the ...
9
votes
3
answers
1k
views
Does it make sense to use jQuery in modern-webkit-only web applications?
I'm lately working on a few mobile web apps for Android (2.3+) and iOS (4+). Their browsers support most of ECMAScript5, which is very powerful, and I wanted to use language features where possible, ...
14
votes
5
answers
7k
views
Why is JavaScript not used for classical application development (compiled software)? [closed]
During my years of web development with JavaScript, I come to the conclusion that it's an incredible powerful language, and you can do amazing things with it.
It offers a rich set of features, like:
...