Skip to main content
Filter by
Sorted by
Tagged with
-7 votes
0 answers
64 views

I have spent time researching this on MDN and exploring similar questions on Stack Overflow. Most solutions cover static filtering (e.g., item.category === 'Web'), but my challenge is that the filters ...
Jasur's user avatar
  • 1
Advice
1 vote
6 replies
118 views

If we round a negative number to the nearest integer in JavaScript, in the case of a tie (i.e., a fractional part of 0.5), the nearest integer is the one closer to positive infinity. For example: Math....
4ou4's user avatar
  • 1
Advice
0 votes
4 replies
73 views

Hi everyone, I am a developer with a deep interest in JavaScript. I have been working with the language for some time, but I’ve reached a plateau where I'm unsure of my current proficiency level or ...
Bhanu Sharma's user avatar
Best practices
1 vote
4 replies
147 views

How can i create a mini quiz app with pure vanilla JavaScript which takes questions and presents options which include the correct answer and output the scores with a next button which switches the ...
Ekedegba Benedict's user avatar
1 vote
0 answers
73 views

The documentation says: Statically Served It is possible to manually download the files from https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm/dist/. import * as duckdb from '@duckdb/duckdb-wasm'; ...
Tomáš Zato's user avatar
  • 54.1k
Best practices
0 votes
10 replies
95 views

How do I use async function as Promise executor in js? The following won't work: new Promise(async (resolve, reject) => { //something });
145a's user avatar
  • 3
Advice
0 votes
0 replies
55 views

How do we load ML5 as an ES6 Module? I have tried: import ml5 from "https://unpkg.com/[email protected]/dist/ml5.min.js"; // but no default export import * as ml5 from "https://unpkg.com/ml5@1....
Dan Zen's user avatar
  • 555
-1 votes
1 answer
96 views

I was brushing up on Array for an implementation and I stumbled on this discovery, I expected the following code to give me an array filled with the number 42: Array(3).map(x => 42) But instead, ...
UncleBigBay's user avatar
-4 votes
1 answer
154 views

I'm learning JavaScript and practicing merging arrays. Here's one of the methods I wrote using two for loops: const arr1 = [4, 5, 7, 9, 8]; const arr2 = [-1, -2, 0, 12]; const arr3 = []; for (let i = ...
user31029120's user avatar
2 votes
1 answer
121 views

I’m experimenting with the ECMAScript proposal for ShadowRealm and ran into some deeply unintuitive behavior around object identity, function bindings, and prototype inheritance across realms. ...
dailker's user avatar
  • 56
-4 votes
1 answer
141 views

I'm getting syntax errors when trying to modularize a Google Apps Script HTML project. The issue appears to be related to how the HTML service processes included files as templates rather than raw ...
Rafael Fontana's user avatar
-1 votes
2 answers
130 views

I am using ixjs/AyncIterable (pull-model). The simplest code I need to write at the end, to initiate the stream processing is: for await (let i of asyncIterable); But eslint does not like this: 'i' ...
Marinos An's user avatar
  • 11.3k
2 votes
1 answer
108 views

I modify the handler object after proxy's creation, and obtain intended result. But nowhere in mdn document such pattern, can i rely on this pattern to work consistently across browser/in future? ...
StructSeeker's user avatar
0 votes
2 answers
222 views

In an existing web app written in Vue and PHP, we are trying to add a Micro Frontend using Module Federation. After we configured the app, I found out that the watch command wasn't working correctly. ...
Giorgio Tempesta's user avatar
1 vote
2 answers
120 views

I wish to create a class which extends EventTarget, allowing addEventListener() and dispatchEvent() to be invoked on it. Logically, my class wants to be a singleton; if a page accidentally ...
John Leary's user avatar
1 vote
0 answers
80 views

I am writing documentation for some classes written using the ES6 class syntax. I have some classes which inherit their constructor from their parent class, as below: /** * @class */ class Parent { ...
jban28's user avatar
  • 113
2 votes
2 answers
171 views

I have a Firebase Functions project that has "type" set to "module" in package.json so that I can use ES6 syntax. Some of the files import data from another json file with a line ...
Matthew Michaud's user avatar
-3 votes
1 answer
81 views

my codes console results Here are my React codes. I know that if you write a function with a parenthesis, it will be called immediately (in this case, it will be called when elements render, I have ...
Filics's user avatar
  • 3
-1 votes
1 answer
400 views

I'm working on a figma plugin where in I need to use the components which are in published library assets. I know I should be using figma.importComponentByKeyAsync() of figma plugin API, but I m not ...
Abhishek Konnur's user avatar
0 votes
0 answers
153 views

In a webapp we are trying to solve an Open Redirect vulnerability. The code is like this: window.location.href = DOMPurify.sanitize(data.href); Which apparently is vulnerable. One recommended solution ...
Lennart's user avatar
  • 1,048
1 vote
1 answer
57 views

I'm trying to create a parent class A with a private field #abc and a subclass B that overrides this field. However, when I call methods from the parent class that access the private field, it still ...
pery mimon's user avatar
  • 8,469
0 votes
1 answer
46 views

I am including the vega module in a module: import vega from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm'; This works without console errors on Chrome, Edge, and Firefox, but not Safari.Inspecting ...
Jeff E Mandel's user avatar
0 votes
1 answer
58 views

The CloudAnt server says it is using CouchDB 3.4.2, and ES6 support was added to CouchDB in version 3.0..., but I am not able to use fat arrow function syntax in the online view editor for my ...
Jeff Lowery's user avatar
  • 2,619
0 votes
2 answers
84 views

HTML : <html> <body> <div id="a"> </div> </body> </html> Above is my simple html given and i wrote a function to add a children div ...
Ganesh Bingi's user avatar
1 vote
0 answers
36 views

According to the specification, are built-in Javascript static methods, like Array.from, Object.assign, console.log, etc meant to be bound or do they need to be invoked via the constructor/object? ...
Aayla Secura's user avatar
0 votes
1 answer
97 views

I'm having some trouble wrapping my head around inheritance in ES6 classes. Searching here, most of the answers are 10+ years old so I don't think they apply still. Let's start with the sample code: ...
Sol's user avatar
  • 891
-1 votes
2 answers
61 views

I don't even know if this is possible, something told me to do functional components but I am already too far deep into the code and I am scared to go back (this is an issue I must learn to tackle but ...
barrington hebert's user avatar
0 votes
2 answers
108 views

I have FileA that dynamically import FileB from different directory. The dynamic import fail because FileB importing module 'lodash'. The error show Error [ERR_MODULE_NOT_FOUND]: Cannot find package '...
Don John's user avatar
-1 votes
1 answer
71 views

var obj = { method : () =>{ console.log(this) } } obj.method.apply(obj) I'm trying to use .call or .apply to set the this context for an arrow function, but this remains undefined. ...
MOHAMED SIKKANDAR AFZAL M's user avatar
0 votes
1 answer
65 views

The ECMAScript specification has a section about the modules. Link() is a method on Cyclic Module Record that runs another method called InnerModuleLinking, which passes the current module (namely ...
MaximPro's user avatar
  • 566
1 vote
1 answer
41 views

We are trying to build a javascript library (dwbn-event-webcomponents), that can be imported into a typescript project (angular 17) and also used standalone. It was installed via npm from git url. In ...
Andreas's user avatar
  • 2,251
-1 votes
1 answer
88 views

I'm building an admin dashboard and i want to count users created in given month or year. I'm using the countDocuments() method with the query param "createdAt" but the result is 0 and i'm ...
fathi93's user avatar
  • 347
0 votes
1 answer
123 views

I am trying to use EmailJs to send Emails from my NodeJs backend. I am using ES6 version of JS. I installed EmailJs using command: npm i @emailjs/nodejs After that I checked my nodemodules directory. ...
Shahood Amir's user avatar
1 vote
0 answers
64 views

Why is it happening and how to fix it? To reproduce comment/uncomment generateKey call and watch the event handler (you might want to put into a module (which is how I use it) or execute is as part ...
vladimir_1969_2's user avatar
1 vote
0 answers
132 views

I'm sure this is the expected behaviour but it looks counter-intuitive for me. Given the following snippet, why is item inferred as { a: number } instead of { b: number }? I was expecting a kind of ...
sgmonda's user avatar
  • 2,727
-2 votes
3 answers
94 views

I have this code: const newDiv = document.createElement('div'); newDiv.innerHTML = ` <button class='btn btn-download'> <span class='icon'>&#...
Shibaji Biswas's user avatar
1 vote
1 answer
220 views

Working on a web app for a specialized device that runs Android 10 (Webview uses Chromium <80). When I try to serve the app and test on the Android device, I get errors for using optional chaining ...
ianrose2k's user avatar
0 votes
1 answer
105 views

On Server Application Structure documentation page of Socket.io, two methods are presented to use modules for better code clarity. Those modules are CommonJS. I managed to translate the first to ESM, ...
Akyno's user avatar
  • 1
0 votes
2 answers
103 views

I am learning promise chaining and I stumbled upon a doubt. Consider the below promise chain - const myPromise = new Promise((resolve, reject) => { setTimeout(() => { resolve("...
Arman Lalani's user avatar
1 vote
1 answer
75 views

As defined per WebIDL specification, setting attribute on an interface should convert the JS value to its IDL equivalent. It is explicitly stated that if the value cannot be converted it should throw ...
GulgDev's user avatar
  • 44
6 votes
0 answers
1k views

I've converted my webpack project to output ES6: experiments: { outputModule: true }, output: { library: { type: 'module' } }, Now, when I run in dev mode (...
BJC's user avatar
  • 71
1 vote
1 answer
102 views

I'm looking for something like html-webpack-plugin, but instead of HTML, it will output to a javascript file that loads everything else. I've found js-entry-webpack-plugin, but it doesn't output ...
BJC's user avatar
  • 71
-1 votes
1 answer
139 views

Consider a scenario where I have two tasks - Task 1 is a callback which is set to be executed after 1 sec using setTimeout. Task 2 is a synchronous/blocking task which takes comparatively more time ...
Arman Lalani's user avatar
-1 votes
2 answers
83 views

consider below 2 array of objects, say arr1 and arr2. based on id, if any new item exist in arr2 copy item to arr1 and remove item from arr1 if that item not present in arr2. Tried something like this,...
Praveen Kumar's user avatar
0 votes
1 answer
189 views

I want to Apply, "Apply To All" and "Apply to GroupBy" for the rows I'm using with the use of Material UI. I want to create a button "Apply to All". When the user Edit ...
user1931511's user avatar
0 votes
1 answer
30 views

I have a command to run the linter graphql-schema-linter -c build-util/config but we have upgraded our project to use Vite instead of Laravel Mix. We are now using CJS files for some of the JS files ...
James Arnold's user avatar
0 votes
0 answers
84 views

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 ...
MalackaPower's user avatar
-2 votes
2 answers
112 views

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": &...
volume one's user avatar
  • 7,601
1 vote
1 answer
179 views

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 ...
user26500190's user avatar
1 vote
0 answers
56 views

When I run the following code in Node.js: class Superclass { constructor() { this.setPrivateField(); } setPrivateField() { // No implementation } } class Subclass extends Superclass {...
Natalie Weizenbaum's user avatar

1
2 3 4 5
599