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
-3
votes
0answers
21 views

How would I re-create the "click and drag" create event Google Calendar interface? [closed]

My apologies if this is a basic design question. I would like to create a survey app that allows people to create calendar entries across the timeline of a day, where they can click and drag to create ...
4
votes
3answers
459 views

How do you 'merge' several JS files into one? [closed]

New Web Dev here. Recently I got into DOM manipulation with JS, everything was sweet with one-page websites, but then I tried with projects with many html files and that's when I got confused. It's a ...
-2
votes
1answer
61 views

Creating a promise based API, from a message based API

I'm building some software that behind the scenes needs to communicate with hardware via a "message" API, over a named pipe. For example, I can send this message: <?xml version="1.0&...
-2
votes
0answers
20 views

Concept Check: Data Server Nodes, Fetch Nodes

I had this idea for a way to make it possible to run a MUCH MUCH smaller node but still mine on a chain. I don't know if there is anything useful in it, but decided I would post it here for feedback ...
0
votes
2answers
174 views

Should a client / server share error codes?

I am in two minds about sharing client / server errors codes. We are writing both ends of the system, if our API was external this would not be possible, but that requirement is very unlikely. So an ...
0
votes
0answers
12 views

Managing user session state with Google Sign In

I need some help with my authentication design. Happy to share any code as needed... Overview I have implemented the Google Sign-in (new web implementation here) button in my client web application. ...
0
votes
1answer
43 views

NextJs Explanation on Ecommerce and Other Project Implementation [closed]

I'm attempting to create a project to increase and enhance my coding skills, and I've lately migrated React to Nextjs. I've noticed that NextJs' main point or strength is rendering; Could someone ...
0
votes
2answers
91 views

Sharing logic / services across modules in "clean" architecture [closed]

I am trying to implement a layered architecture consisting of; Controller, Service, Repository, Entity. Each module has at least some of the above layers. I am often finding that modules need to share ...
-1
votes
1answer
52 views

How to use external validation libraries for entities in a "clean" architecture?

I would like to make use of a external library to parse the core domain entities. Doing this in a naive way it would look like the following: import { z } from 'zod'; const Audience = z.object({ ...
1
vote
1answer
65 views

How do I share translations between a .NET application and a react application?

I currently have two applications where one is a landing page (built in react) and another is a web page that lets users explore data (Written in ASP.NET 4.7). I'm currently using resx files to handle ...
0
votes
1answer
71 views

Javascript and payment security

I'm using a third party CRM application which allows you to build web forms using drag and drop widgets and the ability to add javascript code to manipulate those widgets. I need to build a form to ...
38
votes
6answers
10k views

In JavaScript, how is awaiting the result of an async different than sync calls?

I'm having a hard time wrapping my head around the use of async/await and regular sync function calls in JavaScript. Let's say I have two functions: Function 1: async function doSomething() { ...
1
vote
2answers
117 views

How to create an API on Node.js that needs to be updated once a day?

I want to create an api based on Node.js and Express.js. This api should return an array of products on /products. To get these products on my node server, I need to call a third party api. However, I ...
2
votes
0answers
39 views

Software design for an Angular highlight&comment tool

We're building a new feature for an online editor that the user will not edit the document, but will be able to highlight & propose edits on the document. Very similar to google documents' ...
1
vote
2answers
101 views

QR Code Scanning with location check

I would like to make an order-system with QR-Codes which is online. How I imagine it to work: A customer visits a restaurant. There is a QR-Code on his table which takes him to a public webpage where ...
1
vote
1answer
35 views

Re-export (certain) library components from barrel file

Situation At the project I'm currently working on we're using Chakra UI to create our UI. But I guess this question applies to whatever (UI) library you're using. There are certain components that ...
3
votes
4answers
2k views

How to store a password so that it can be passed to another site/service which is expecting a plaintext input

I am developing a website and I would like to allow users to use XMPP for live chat. I would like users to have the option use an existing XMPP account if they wish and store their XMPP username and ...
-1
votes
1answer
46 views

How can I pass a large amount of data from a JavaScript client to the web server in bulk

I have a Vue/Quasar application that allows the end user to convert an Excel Spreadsheet into an Array and load it into a DataGrid. The Spreadsheet has a list of peoples names, email address, ...
0
votes
2answers
44 views

Scheduled Task in webservice

The requirement is to trigger certain tasks (API calls) periodically for each user. But the frequency (time between triggers) is not fixed, the user can change it. In my existing solution I maintain a ...
1
vote
1answer
154 views

Managing multiple state machines interacting with each others in ES5 Javascript

I have multiple state machines (7) managed by a "main" function. Because of system constraint this will be run on an old qtweb browser with ES5/IE11-like behaviour. So no promises etc. I'm ...
0
votes
1answer
95 views

Which one is good practice to do something like 'out' from C# in JavaScript? [closed]

Since I met the out keyword in C#, I'm trying to find an equivalent approach in JS. So, please take a look at the code and leave your opinions of existing cases or suggestions of new ways to implement ...
0
votes
0answers
28 views

How to validate against changes to "illegal paths" in backend requests for complex data structures?

We are building a backoffice web application where people are making changes to an array of nested objects. Because of totally non relevant business reasons there are things that users cannot change ...
1
vote
1answer
121 views

Is usage of "global" types in typescript considered bad practice?

I'm fairly new to strongly typed languages, coming from the "jungle" world of JS and PHP. In my current Typescript project(React-Typescript), i'm struggling with a very fundamental question: ...
1
vote
2answers
120 views

Is it better practice to create a div in the html or using javascript

I have javascript script that creates the same div everytime the user clicks enter and then set the event listener to the new input in the new div. example: //creates the container, text and input for ...
1
vote
1answer
52 views

What determines if a data type is an object or a primitive data type in JavaScript?

I have read that the null data type in JavaScript is a primitive data type, however due to a bug or something in the first version JavaScript, null is considered to be an object. However, let's assume ...
0
votes
1answer
82 views

At the implementation level, how are JavaScript values represented in memory? [closed]

I want to know how variables are stored in JavaScript (what I mean is, how JavaScript stores the type and the value of the variable and stuff like that). But I was only able to find a tutorial about ...
0
votes
1answer
118 views

Is a good practice using form tag's atributes in HTML?

Checkout this HTML using the attribute action, method and target from <form></form> tag: <form action="/action_page.php" method="get" target="_blank"> ...
0
votes
1answer
119 views

How to execute code "under the hood" in my no-code platform

As a learning project I started looking into how to mimic some basic features of a no-code platform. I usually code in Java/Python, have good knowledge over Javascript/HTML, but wanted to use this to ...
7
votes
2answers
460 views

Why are sort() and reverse() JavaScript methods in-place?

Which are the technical reasons/considerations for the sort() and reverse() JavaScript array methods to be in-place operations instead of returning a new array without modifying the original one, like ...
1
vote
1answer
196 views

Advantages and disadvantages of including JS/CSS inside the HTML?

What are the advantages and disadvantages of including JS/CSS inside the HTML instead of separated files? Specifically concerned about performance issues, for example, if the CSS and JS are small and ...
1
vote
2answers
646 views

lambda function vs anonymous function vs callback function

I'm writing a introductory JavaScript tutorial series, I have a question about terminology. When explaining the Array.prototype methods, I've given an example of some code like: const letters = ['a', '...
-1
votes
2answers
117 views

Using OOP objects mapping to DOM elements vs. querying the DOM repeatedly?

I'm trying to make better use of OOP, but I don't have good instincts for this yet and I sometimes worry I'm making things more complicated and/or less efficient. I'm wondering what is the best way to ...
-2
votes
1answer
30 views

Do I need a separate backend (Express) for an Angular project if using AWS for data storage?

So, I'm working on developing my first Angular project with/for a friend of mine and I have a design question before I really get started with things. I'm going to be storing persistent data on AWS ...
0
votes
0answers
32 views

How to best process unreliable conditional data on the frontend?

For the past couple of weeks, I was working on creating a simple visual display of some data as bullet points. I already have a solution for the title but I wanted to post this question, to hopefully ...
0
votes
0answers
58 views

MVP in plain JavaScript with nested components

I've been working on a system which has a number of MVP components implemented in plain JavaScript. They are instantiated from a main file and have no knowledge of each other which is great so far. ...
0
votes
2answers
122 views

Dependency injection vs other design pattern

I really don't love the design pattern I've established here. It's kind of DI but not really, and the alternative is more constructor based DI, but I also hate it. Maybe it is because it is JS and ...
0
votes
1answer
509 views

Rabbitmq create queues dynamically based on number of users

I have a scenario where I have to route a list of messages that I get to respective users. For suppose if I have messages = [ { text: 'hi', user_id: 1 }, { text: 'hi', user_id: 2 }, { text: 'hi',...
3
votes
3answers
679 views

Should try-catch blocks be used when calling functions that already have them?

In JavaScript, if I have try catch blocks in a function that is meant to be called from another function, should I also put them in the calling function or just let the called functions handle them. ...
0
votes
1answer
48 views

How are discriminated unions (e.g. in TS) used in messaging schemes?

In the documentation about discriminated unions in typescript, here it says: Discriminated unions are useful for more than just talking about circles and squares. They’re good for representing any ...
0
votes
1answer
111 views

How encrypting website data works

If i wanted to encrypt a password on my website before its sent to the server, would i have to encrypt the password in javascript on the frontend for it to be hidden over the interent or could it be ...
2
votes
1answer
310 views

When should a variable be declared / Value assigned?

So we have quiet a big TypeScript codebase at work, where each method resides in its own file. Now in a lot of those methods the variables are often declared all together at the top/beginnng of the ...
5
votes
3answers
389 views

Qualms over the 'flexibility' advantage of using dependency injection

I'm currently studying dependency injection and I'm having some issues with the so called 'flexibility' advantage of using dependency injection. The flexibility advantage is mentioned in post ...
-2
votes
1answer
96 views

How to warn devs after installing or updating npm packages? [closed]

I want to warn devs in my team to rebuild the docker containers after installing or updating npm packages. This is because whenever we edit packages in the environment the only way we've found to test ...
0
votes
0answers
40 views

Mediator design with a circulator dependency

My project is web related, and the intent is that I am decoupling two pages worth of actions so that each class would have a list of actions on their page, and if any action so happens to navigate to ...
0
votes
1answer
81 views

What is the use case of BroadcastChannel API?

I'm reading about BroadcastChannel API https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel . It seems that it is already on market for a long time, and quite cool as well. However, what ...
2
votes
4answers
479 views

Do all dynamically typed languages not support function overloading?

I have noticed that JavaScript and PHP and Python do not support function overloading. Do all dynamically typed languages not support function overloading? If the answer is yes, then why is that?
0
votes
2answers
445 views

Defining default values for Boolean arguments in JavaScript

Is it usually recommended to define default values for Boolean arguments? I mean, is it usually recommended to define a function like this someFunction(a, b, x) { // a and b are strings, x is true ...
1
vote
2answers
86 views

Using objects to construct nearly the same objects

I am getting worried I have some terrible design pattern here in JS/Node.js/MongoDB. It seems to that to create an object, I need an object that looks like that object. This includes data that comes ...
1
vote
2answers
387 views

JS - two array filters vs. one forEach?

I've had a question for a while. I know that the Array prototype method filter is generally preferred over forEach, and I believe it is typically faster at the job as well. But what about if I have ...
0
votes
2answers
53 views

Strategy for Chrome timing out on a Database cleanup job which takes a long time

I have a notifications app which sends users notifications. It uses a .NET core backend, an angular frontend and Cosmos DB. Within this I have an API endpoint function which is linked to a button used ...

1
2 3 4 5
42