Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
61 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 ...
Don Hatch's user avatar
  • 5,244
0 votes
0 answers
34 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 ...
flixe's user avatar
  • 626
-3 votes
0 answers
74 views

Javascripts Array.fill() Peculiar Behaviour [duplicate]

Why is it that the output so weird! What is the fill method actually doing? Expected output: [[0, 0, 0], [0, 5, 0], [0, 0, 0]] Actual output: [[0, 5, 0], [0, 5, 0], [0, 5, 0]] let matrix = ...
Avanteesh's user avatar
0 votes
2 answers
47 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 =...
Monnt's user avatar
  • 13
1 vote
1 answer
63 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 ...
fedd's user avatar
  • 902
0 votes
0 answers
26 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 ...
Abhishek Konnur's user avatar
-1 votes
0 answers
24 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. ...
theSpellBinder's user avatar
-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": [ { ...
copenndthagen's user avatar
-1 votes
1 answer
33 views

Using "type": "module" in package.json breaks javascript default parameters

I have a package.json file that contains the line "type": "module",. This line triggers errors when running node a_script.js. Its as if the default parameter functionality of ...
erikejan's user avatar
0 votes
7 answers
105 views

Array of objects reducing based on multiple parameters

Need to reduce an array of Objects to return the highest value of the same name. Need the following, [ { name: 'a', value: 20, ...(other object values) }, { ...
caiovisk's user avatar
  • 3,759
0 votes
0 answers
16 views

figma groupnode children does not load when consoled, there is a delay

I m working on a figma plugin using figma plugin api, but when im trying to get all children FrameNodes from rdLayer[0].children then only 1 FrameNode is consoled, but when setTimeout is used then it ...
Abhishek Konnur's user avatar
1 vote
1 answer
63 views

JavaScript class with static methods vs object with function properties

In JavaScript (and TypeScript) is there any difference between using a class vs an object to namespace methods from a performance perspective? And are there any other reasons to prefer one option over ...
Cam Parry's user avatar
  • 116
0 votes
0 answers
24 views

Regex Word Boundaries (ECMAScript Flavor): Strings starting with Umlauts are inverting \b? [duplicate]

It seems that when using the \b word boundary in a Regex, which is used in JavaScript via the "RegExp" class, the logic of the boundary gets "inverted" if the string starts with an ...
Patrick Fleck's user avatar
1 vote
1 answer
47 views

How to find where promise was created?

I posted this question a couple of days ago, then removed it after I was pointed that it essentially didn't demonstrate the problem I was dealing with. Then I was asked to restore the question, but I ...
d.k's user avatar
  • 4,396
-3 votes
0 answers
38 views

What would be the reason for null being equal to undefined [duplicate]

If equality check null and undefined with == then the result will be true console.log(null == undefined) //true console.log(null === undefined) //false I have done a check like const nullValue = ...
Ansam Chemban Davis's user avatar
0 votes
0 answers
23 views

Is there a way to paralellize db operations with Node.js, that I can use ES6 + typescript on?

I want to make a CRON job that handles some db operations by making X threads and assigning a range of indexes in the db that each thread will handle. I've tried using worker-threads but it has no ...
Dudu Dudu's user avatar
  • 179
0 votes
0 answers
16 views

Cannot assign to read only property 'message' of object 'SyntaxError: /src/component/Heading.jsx: Unexpected token, expected "{" (27:7) [duplicate]

Current i am trying to returning a object look like {text,object} from and jsx but i am keep getting this error Cannot assign to read only property 'message' of object 'SyntaxError: /src/component/...
Ayush Kumar's user avatar
0 votes
1 answer
33 views

Why is the default event action prevented when calling e.preventDefault() in the parent element?

The default action when pressing nav__link is to go to a certain section. When I don't have e.preventDefault() in the parent element, the default action of going to a section is executed. But when I ...
theSpellBinder's user avatar
1 vote
0 answers
58 views

Script runs twice when I `import` a variable

I would appreciate a quick help. I’m working on this project and there is a part where I have to use the scene variable elsewhere so I exported it but every time I import it, the main.js where the ...
Elo Hell's user avatar
1 vote
1 answer
68 views

Using ECDSA for Encrypting Data in C#

I'm trying to come up with an interopable crypto algorithm (by interopable I mean the ability to sign/encrypt data in c# using keys generated by JS and vice-versa). I took ECDSA as a base as it looked ...
JsCoder's user avatar
  • 2,211
0 votes
0 answers
172 views

How do I allow import.meta in nextjs _next/static/media directory?

I'm creating an app which uses wasm and other JavaScript files which I personally have not created. These files generate a file which is stored at this url: http://localhost:3000/_next/static/media/...
charlietlamb's user avatar
0 votes
1 answer
41 views

Sort function to achieve custom difference along with multiple columns

Trying to achieve custom sort as below: // 1. sort by 'value' column, here 'a' (first object) and b (second object) has difference equals to 4.5 or less then 4.5 then, // consider equal values (even ...
dsi's user avatar
  • 3,329
-1 votes
2 answers
30 views

How to figure out what string was inserted somewhere into a known other string?

I’m looking for the most straighforward way to figure out which string was inserted somewhere into a known other string. Here’s what I have to work with: I have an existing variable representing a ...
Ashley Bischoff's user avatar
0 votes
0 answers
189 views

Cannot read properties of undefined (reading 'default')

I have an issue that I haven't resolved yet. So I'd like to make a post to get support from everyone. I have a components folder, and inside it, I have a root file (index) and a file named ...
Dynamo's user avatar
  • 33
0 votes
1 answer
37 views

Bulk Calling of API in React and JavaScript/Typescript That Based on Previous Response

I have a bulkSave function and I wanted to call API's repeatedly. Succeeding API depends on previous API. My problem is if createProjectPeopleOrganization returns successfully while ...
Joseph's user avatar
  • 7,606
0 votes
0 answers
66 views

Named export not found after building typescript library

I'm having troubles with a library I'm bundling with Rollup. When I serve the typescript application that consumes the library I get this: SyntaxError: Named export 'enc' not found. The requested ...
Sampgun's user avatar
  • 2,900
0 votes
1 answer
32 views

What is the difference between below two different ways of writing the react code [duplicate]

I recently started exploring react, functional components, fat arrow syntax, anonymous functions, redux, store, state, props, mapping and wondering what the difference between these two syntaxes is ...
Jay Bhiyani's user avatar
1 vote
0 answers
52 views

Javascript error running Rails 7 app on IOS iPhone/iPad

We have an app build in Rails 7 with a Postgres database and uses Bootstrap 5 for the UI components. Pretty basic but effective app. The app works fine on Windows and Mac browsers and on most Android ...
Daniel Grenier's user avatar
0 votes
1 answer
21 views

Preventing Automatic Restart of a Countdown Timer in JavaScript

I'm currently developing a countdown timer using JavaScript, and I've encountered an issue where the timer automatically restarts after reaching 00:00:00. My initial implementation attempts to reset ...
Arslan Asif's user avatar
0 votes
1 answer
37 views

How can I construct a variable in JavaScript based on another variables value? And How can I reassign it's value and perform methods on that variable? [duplicate]

I want to be able to basically do this let x = 1; let `arr${x}`; if ((i = 0)) `arr${x}` = []; `arr${x}`.push(words); console.log(`arr${x}`); I have tried using eval() let x = 1; eval(`let arr${x}`); ...
huz3y's user avatar
  • 21
1 vote
0 answers
63 views

default export - is not a function

I'm currently working in a legacy project that's built using CommonJS. But because I needed to use react-pdf to create PDF files, I had to add .mjs files to my project. This works fine on the dev ...
SaltyPotato's user avatar
-1 votes
1 answer
73 views

What is the best way to define JSON serialization format for a class in TypeScript?

I am developing a program with Angular and TypeScript. I have a class called Signal, which has the following properties: export class Signal { id: number; obraId: number; obra: string; ...
Alba's user avatar
  • 460
-3 votes
1 answer
58 views

How to get distinct array values from nested array

I would like to get distinct studentId and classNo from a nested array objects. Const arr = [ { "studentId": 70, "data": [ { "studentId": 70, ...
Lineesh Mb's user avatar
0 votes
1 answer
131 views

Nodejs ES6 import issue with AWS Lambda & Layer

I'm using NodeJs(ES6) on AWS Lambda with node_module as AWS Layer and I want to publish a message on SNS. The above code works perfectly with CommonJs syntax but using import syntax (ES6) facing an ...
Mayur's user avatar
  • 601
0 votes
1 answer
42 views

clearTimeout a timer in a function with another function (React.js)

The code is for a Navbar. I want this when the mouse got out of it this timer started, but while this time was counting if I moved my mouse over the Navbar, the timer counting being stopped and ...
Darigan's user avatar
  • 68
0 votes
1 answer
45 views

Aura to LWC recursion method migration

I have an older Aura method here that I want to translate to modern Javascript. For some reason I keep getting different output. I console log before recursion (data), then I console log before the ...
lache's user avatar
  • 724
0 votes
1 answer
29 views

Why are my scatter points plotting in vertical lines in highcharts

I have a scatter plot that has been created using Highcharts. Why are the points being generated in straight lines and not like a normal scatter plot? My code: Highcharts.chart('container', { "...
nb_nb_nb's user avatar
  • 1,347
1 vote
1 answer
32 views

How to make XAxis less crowded and not display all dates on spline chart using highcharts

I have a spline chart that is generated with Highcharts. How to make the x-axis less crowded? This is a month's worth of data. Sometimes the data can be more than that. On the x-axis, sow only few ...
nb_nb_nb's user avatar
  • 1,347
0 votes
0 answers
21 views

Repeated calls to console.log in Safari 17 give no output

When I call console.log(1, 'foo') in Safari 17's Javascript console it prints 1 and "foo" as expected after the first call but then the second call prints nothing as seen below. When ...
Dimensional's user avatar
0 votes
3 answers
83 views

Javascript promise chaining not working as expected. After going inside catch block it is still throwing error

I have tried to implement promise chaining in Javascript with 3 simple promises. First promise I am resolving and last 2 I am rejecting. Till 2nd rejection it is working fine. But after the catch ...
Soumya priyadarshi Das's user avatar
0 votes
1 answer
74 views

Generate Dark Colors Only in React and JS

I have an <Avatar/> component and the text inside of it is color white, How do I make sure that its background color is dark so the text can be seen since its dynamically generated? Codesandbox -...
Joseph's user avatar
  • 7,606
1 vote
1 answer
100 views

Getting First Letters of First Name and Last Name in JS

I wanted to retrieve the first letters of a person's first name and last name using modern JavaScript syntax. Currently, I'm able to retrieve the first letter of the first name and the first letter of ...
Joseph's user avatar
  • 7,606
1 vote
2 answers
52 views

Retrieving Some Texts in Javascript

I wanted to retrieve the first letters of a person's first name and last name using modern JavaScript syntax. Currently, I'm able to retrieve the first letter of the first name and the first letter of ...
Joseph's user avatar
  • 7,606
1 vote
2 answers
66 views

Why I'm hitting time limit!? LeetCode Linked List Cycle (Solved but explanation needed!)

I'm working on solving LeetCode problem 141. Linked List Cycle: Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is ...
Simone Anthony's user avatar
0 votes
1 answer
35 views

How to pass a state change on a button click as a prop to a child component and track that change on Solid.js

This is how I'm passing my prop const [showShoppingCart, setShowShoppingCart] = createSignal<boolean>(false) const showCart = () => { setShowShoppingCart(!showShoppingCart()) } ...
JSnow's user avatar
  • 959
0 votes
0 answers
39 views

Error: [ERR_REQUIRE_ESM] in Typescript Sequelize

When I try running any command in Sequelize, inside or outside the docker container, that needs the configuration file (In my case, config.mjs), I get this error: Error reading "build/database/...
Giovani Souza Kill StevePlays's user avatar
0 votes
1 answer
69 views

Webpack's ambiguous relationship with ES6 modules [closed]

Does Webpack support ES6 modules natively or not? This is a simple question but its answer seems to be more complicated than I initially thought. On one hand, Webpack allows you to use ES6 syntax ...
e18r's user avatar
  • 7,973
0 votes
2 answers
312 views

A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

I am working on react-native cli project. In this project I got errors which starting the dev server which is as follows: ERROR Invariant Violation: "frontendnative" has not been ...
Tayyab Gèé's user avatar
0 votes
0 answers
14 views

ckeditor5 DropdownField label does not update

Within a drupal module, a custom plugin has been created. I am using the advanced plugin walkthru from ck5 docs to implement a contextual balloon. Objective: Have a dropdown populate its button label ...
arkjoseph's user avatar
  • 494
2 votes
2 answers
136 views

Material UI Autocomplete Categories in ReactJS

I'm using MUI Autocomplete and Formik and I wanted to group this into categories. If it has no sub_accounts, then it shouldn't have a header label. Something like this: https://mui.com/material-ui/...
Joseph's user avatar
  • 7,606

1
2 3 4 5
600