Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [javascript]

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.

Filter by
Sorted by
Tagged with
-4 votes
3 answers
253 views

I have written a parser for Transfer-Encoding: chunked requests over HTTP/1.1. Now I'm working on optimizing the code. This is the specification 7.1. Chunked Transfer Coding. The first optimization ...
guest271314's user avatar
-4 votes
2 answers
247 views

I'm working on implementing parsing a series of Uint8Arrays that contain Transfer-Encoding: chunked data sent from the client using WHATWG Fetch over a single connection. For example, writing 1 MB ...
guest271314's user avatar
3 votes
3 answers
233 views

I'm trying to implement a heartbeat feature for offline tracking that just sends an offline message to the server once the web browser app (Laravel-based) is offline. Ideally it will ping the app's ...
meowyn0316's user avatar
2 votes
1 answer
105 views

I have a tumor dataset in R that is a Seurat object. I am working on a project to develop a new visualization tool for single-cell RNA-seq data. I want to develop the visualization using JavaScript, ...
waldo_gb's user avatar
3 votes
3 answers
193 views

I was implementing a hashing function for a class and I took a minute to look at the first-party collection package for Dart to see how they implemented their hashing function for collections. They ...
Abion47's user avatar
  • 141
5 votes
2 answers
1k views

I have the plan for an UI component hierarchy. Each UI component contains zero or more children UI components, and each UI component may set an optional theme. A theme is responsible for skinning a ...
Hydroper's user avatar
  • 197
1 vote
4 answers
355 views

Note: I am not super knowledgeable web javascript or streaming, but I have read this and this and this I am proposing an alternate idea and just trying to verify whether I have a sound starting point ...
User45i6h45ih3455's user avatar
-2 votes
1 answer
80 views

I have a website with an online keyboard. Essentially people can type on this online keyboard and send messages worldwide. My problem is users can easily intercept the POST network call to the backend ...
Mason Smith's user avatar
2 votes
1 answer
514 views

I got assigned with writing unit tests for a class that instantiate a Worker inside in it's constructor. The code looks simmilar to this, class SomeClass { private _worker: Worker; constructor(...
LNTR's user avatar
  • 43
-4 votes
1 answer
103 views

Related: Best practice for interoperable TypeScript→JavaScript? - Frameworks, browser extensions Angular, React, Vue, Svelte &etc. exist and are popular. Some use rxjs to flow from HTTP response, ...
Samuel Marks's user avatar
0 votes
2 answers
271 views

All optimising Javascript runtimes use "shapes" (SpiderMonkey term) or "hidden classes" so that instead of objects being treated as the dictionaries or hashmaps they can instead be ...
curiousdannii's user avatar
0 votes
1 answer
144 views

I am writing an application using a C# backend and a Vue frontend, and I am a bit sceptical about where is best to store information about the user that is currently logged in. There are a few posts ...
Cursed_Sauce's user avatar
4 votes
5 answers
625 views

In Javascript, should appending to the signature of a callback be considered a breaking change? I.e. given an operation op(target, callback) should changing it from callback(item, index, array) to ...
BadIdeaException's user avatar
0 votes
0 answers
80 views

I have an image that has been converted to an svg. The conversion looks fine, but it has prefered to use fill instead of stroke. This in itself is not a bad thing in terms of converting a raster image ...
munHunger's user avatar
  • 138
-2 votes
1 answer
363 views

I have a React Redux web app that fetches data from an Express/Node backend and MySQL database. I have a table of records that I fetch and store in redux as an array of objects, which I display as a ...
Display212's user avatar
-2 votes
1 answer
116 views

I am writing a browser-based tool to manipulate and visualise data (with D3.js). Currently, I store data in a JSON format, where each table is an object and columns are arrays. eg: { "data&...
user1505631's user avatar
0 votes
1 answer
924 views

If I have a schema that includes fields that may or may not be set, what is the best way to handle these fields? Should they be optional or instead nullable? Here an example (Mongoose/NestJs) @Schema()...
KorbenDose's user avatar
0 votes
3 answers
261 views

My example applies to reading and deleting files (I/O), but this is probably a common scenario (eg, keeping local and global state in sync in functional programming). I am reading in files from a ...
rpivovar's user avatar
  • 263
3 votes
3 answers
353 views

I am trying to refactor some JavaScript code to use functional programming principles. I have some functions that I want to use in a series of maps. const transformedData = rawData .map(...
rpivovar's user avatar
  • 263
2 votes
1 answer
455 views

I am fairly new to web development and have been trying to figure out the best way to organize my JavaScript files for the front-end. The first approach I started with was "one JavaScript file ...
RotundChinchilla's user avatar
5 votes
3 answers
707 views

This question is not meant to be a critique of functional programming, but more hoping for resources and opinions. I am refactoring some historically messy code so that it follows functional ...
rpivovar's user avatar
  • 263
2 votes
1 answer
127 views

I recently started designing my first MVP-app. I like the idea of having a "dumb" view to be able to cover as much of the code with unit tests. The app I build will be an app to create ...
Ennio's user avatar
  • 39
1 vote
1 answer
635 views

I like to export the names in my modules both as individual named exports and grouped together in a default export. Like this: // mod.js export function f() {} export const x = true export default {f,...
Blue Nebula's user avatar
0 votes
1 answer
782 views

In Javascript, the iteration order of an Object is enforced since ES2020 (or before, depending...). However, is it a good idea (i.e. best practice) to depend on this? I'm currently working on a ...
Kricket's user avatar
  • 733
1 vote
1 answer
247 views

I've been reading Refactoring (2nd) by Martin Fowler. In the first chapter, he shows an example of refactoring a function where he extracts other functions from it and places them inside that function ...
azera's user avatar
  • 19
2 votes
3 answers
565 views

I took over a development team working on life-safety critical software earlier in the year. The product has been in development for about 8 years, but the current team has only been working on the ...
agentroadkill's user avatar
1 vote
0 answers
227 views

I'm trying to make sense of the docs located at: https://developer.mozilla.org/en-US/docs/Web/API/Response/redirected It says Note: Relying on redirected to filter out redirects makes it easy for a ...
PHP Guru's user avatar
  • 111
1 vote
1 answer
561 views

I really don't like media queries in CSS - they have limitations, and on top of that they make the code a lot more confusing. In addition, the restrictions are so strong that when using CSS ...
GeeWay's user avatar
  • 21
0 votes
2 answers
254 views

class ItemList { constructor() { this.list = [];//list holds many instances of Item Class } removeItem(id) { //...search for item in this.list, remove it } } class Item { ...
Tyler Del Rosario's user avatar
0 votes
1 answer
625 views

I am currently struggling with how to solve nested grouping of data. The initial structure is given and my grouped structure below as well as my approach can be adjusted. My idea was to have the array ...
Dollique's user avatar
  • 101
0 votes
1 answer
571 views

I have a Svelte web app exclusively for internal use, so there is no main landing page or registration, as accounts need to be created by the admin. Since the main page has no function as an ...
Jeremy Meadows's user avatar
3 votes
1 answer
293 views

I'm learning JavaScript and just came across "use strict". It sounds like to me it should always be in play but me being a beginner I was wondering if there are scenarios/environments when ...
Meester Moo's user avatar
1 vote
2 answers
366 views

Python, Ruby, Rust, Haskell, Kotlin, C#, C++, Perl, MATLAB, SQL, and R all call their respective array predicate checking functions any and all. Is there any record of why JavaScript's designers ...
Alex Ryan's user avatar
  • 127
0 votes
1 answer
184 views

In MDN article on WeakSets, an example is given for using weak sets to avoid infinite recursion on circular references: // Execute a callback on everything stored inside an object function ...
Anton Strogonoff's user avatar
1 vote
1 answer
307 views

A module app.js includes another module service.js. The service.js module/file contains some functions but also does some module scoped initialisations(registry variable). // service.js const ...
Cap Barracudas's user avatar
1 vote
2 answers
322 views

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 ...
tweekz's user avatar
  • 237
0 votes
2 answers
492 views

I currently am developing a TypeScript shared library. The library needs to be imported in sections to minimize the imported bundle size, so I broke it up into packages with a monorepo with Lerna. ...
devleo's user avatar
  • 51
1 vote
2 answers
4k views

I am a react developer and writing the client on pure JS. I have sometimes missions to received data from server and send data to server. Now between the client team and backend rough discussion ...
Brk's user avatar
  • 31
1 vote
2 answers
152 views

This post assumes, that dtos on the UI side (SPA) could be viewed as business objects in almost all cases - except that the business logic is missing. I'm fully aware that a dtos first responsibility ...
morpheus05's user avatar
0 votes
2 answers
748 views

I will have multiple cellphones playing videos in an art gallery. The video content must be synced to the lights, which are synced to the real-world clock. As in, at 1:00pm the lights go out, 1:15 ...
prismspecs's user avatar
0 votes
2 answers
545 views

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 ...
tweekz's user avatar
  • 237
26 votes
8 answers
11k views

I've got a backend running on Node that executes queries on a PostgreSQL database. For these queries, table and column names are imported from a .env file, for example: const ID = process.env.ID_COL; ...
Lenny Zhou's user avatar
0 votes
2 answers
218 views

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 ...
tweekz's user avatar
  • 237
1 vote
3 answers
2k views

I'm just starting to build a web app using React.js, Next.js, Prisma, & PostgreSQL. In this web app, users can create "projects", which are represented by 10-15 rows in the database. ...
BurstWizard's user avatar
-1 votes
1 answer
117 views

Outline of the current architecture of our web app outlining the issue I'm seeing Client-side app is React, talking to a server running the Play! framework via an API. On the page is a table that ...
bluedevil2k's user avatar
3 votes
1 answer
330 views

Really dumb question. I really like the new feature called "optional chaining" in JavaScript, and it's used in quite a few places in my front end code. However, I am concerned that whoever ...
Rongeegee's user avatar
  • 167
0 votes
2 answers
454 views

I've been tasked with refactoring/simplifying the architecture of a (relatively) large node.js codebase and it makes ample use of global variables. I don't have much experience with javascript so just ...
amy's user avatar
  • 111
1 vote
1 answer
2k views

The company I work for is maintaining and developing a web application that uses many Node.js packages. A lot of these packages are really outdated. I can intuitively understand that it is good to ...
Akaisteph7's user avatar
1 vote
3 answers
239 views

Note: This question is not about this particular instance of this grid with these exact words, but about any combination of words. I am programming a puzzle game where you have to arrange a grid of ...
Florian Walther's user avatar
1 vote
1 answer
411 views

I am making a game of monopoly. Inside my game I have a Board class. The Board class has an array which contains 40 squares. Each square is a different class e.g. ChanceSquare, PropertySquare ...
Kevin Greetham's user avatar

1
2 3 4 5
43