Skip to main content

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
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
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
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
515 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
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
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
-2 votes
1 answer
365 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
0 votes
1 answer
929 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
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
5 votes
3 answers
708 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
1 vote
1 answer
637 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
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
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
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
572 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
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
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
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
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
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
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 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
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
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
2 3 4 5
43