Questions tagged [ecmascript-6]
The 2015 version of the ECMAScript specification, now a standard (ECMAScript 2015). Only use this tag where the question specifically relates to new features or technical changes provided in ECMAScript 2015.
ecmascript-6
29,984
questions
0
votes
0
answers
23
views
Javascript: Any way to create a class by constructing class name using strings/variables dynamically without eval?
I've tried myriads of ways to create new class instances dynamically, without using eval and hard coded key-value pairs, to no avail. Seemingly there is no way in modern Javascript to query the user ...
-2
votes
2
answers
75
views
How to filter an array of objects by key
There are similar questions to this but I cannot find something to tackle this one exactly.
I have an Array that is shaped like this:
AllReviews: [
{"0001": [
{"Review": &...
1
vote
0
answers
21
views
How do I impliment sort by using algolia in Nextjs
I am facing issue while adding sort by feature in my Nextjs project using algolia
useEffect(() => {
setLoading(true);
const index = algoliaClient.initIndex(ALGOLIA_INDEX);
const filters ...
1
vote
0
answers
29
views
Why can't I set a private field in a function called from a superclass constructor? [duplicate]
When I run the following code in Node.js:
class Superclass {
constructor() {
this.setPrivateField();
}
setPrivateField() {
// No implementation
}
}
class Subclass extends Superclass {...
0
votes
2
answers
50
views
Google Apps Script dayjs Plugin Import
I am trying to use the dayjs library in my Google apps script and some of its plugins.
I first added the library to my project by searching for the following script ID:
...
0
votes
1
answer
35
views
How do get search filter data in es6
// Filter rows based on string values and exclude from whiteList
const whiteList = rows.map(sel => sel.RuleAutoID); // Array of IDs to exclude
console.log('whiteList', whiteList);
// Assuming you'...
0
votes
0
answers
18
views
Prototype is showing multiple times [duplicate]
I have implemented inheritance as below:
class Animal {
constructor(name) {
this.name = name;
}
speak() {
console.log(${this.name} is making noise.)...
1
vote
1
answer
27
views
Animation keep restarting with update() instead of playing normally in Phaser 3
I'm using the latest version of Phaser 3, javascript only (no TS).
I have my main scene that contains an update to a Sprite object within its self update method, like so:
MainGame.js
export default ...
1
vote
1
answer
70
views
How do await and Promise.resolve() test whether their arg is a thenable?
I would like to be able to reason about what await will do when it is called on various kinds of values.
The MDN documentation for await describes the decision procedure for that, one of the steps ...
0
votes
1
answer
45
views
Confusion about javascript modules and webpack: The requested module ... does not provide an export named 'default'
I am trying to set up webpack in our javascript project and we want to write new javascript es6 classes, bundle them via webpack and then reuse the packages. I set up a simple example where i define a ...
0
votes
2
answers
49
views
How to see if an array includes a nested array with specific values?
How to correctly iterate through shipMisses array to see if it contains the nested array with the specific values [2, 4] (the dName variabe)?
Here is my code:
shipMisses.includes(dName) // shipMisses =...
1
vote
1
answer
65
views
How do I export await multiple objects in javascript?
There's an example in MDN here,
const colors = fetch("../data/colors.json").then((response) => response.json());
export default await colors;
However, I have multiple constants that are ...
0
votes
0
answers
36
views
Figma plugin API delay in loading all children form a node
I am working on developing a Figma plugin using their API.
As per the below code, I'm trying to access a specific node in the mainLayer.children, but when mainLayer is logged to the console it shows ...
-1
votes
0
answers
27
views
Converting a response to json when using Parcel error
Error message: "Unexpected token '<', "<!DOCTYPE "... is not valid JSON" keeps showing when I run my program using parcel, but when I use live server it's seems to be fine. ...
-2
votes
0
answers
26
views
Javascript find nested object based on attribute name [duplicate]
Given I have a Javascript object as below;
{
"reports": [
{
"folderName": "FOLDER-1",
"folderCat": [
{
...