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
-5
votes
0answers
63 views

I want to know I am okay or not [closed]

I made my first website for about 40 hours. I used html, css, javascript and nodejs. I want to know I am okay or not. On average, how many hours do you make such a first website? https://node41--...
-4
votes
0answers
19 views

How to save multiple files using nodejs and express

I'm building my own code editor with 3 textareas: html, css and javascript. This code editor will save the data of the textareas to single files separately. Using express and nodejs, I manage to save ...
-3
votes
2answers
58 views

Should I use Flask w/ Javascript OR a Javascript UI that calls a Flask / Connexion API?

I recently wrote a data management tool in Python & SQLAlchemy. Now, I need to put a web UI on it. While I want to start small, there is some need for interactivity, like drag and drop in tables, ...
-3
votes
1answer
55 views

Might be inheriting a php spagetti project. Full rewrite in different tech stack? [duplicate]

I'm in dire need of some help. My background is from python, js and ruby, with using frameworks to provide good structure. A potential client has an internal app which does quite a bit of stuff. This ...
-2
votes
0answers
33 views

What is the order of execution for useEffects in a component tree?

I'm trying to understand useEffect a bit more. I was tripped up a few months ago before realizing that useEffect hooks run after all other hooks. I would now like to know whether or not React will ...
0
votes
4answers
181 views

What prevented compiled languages from being adopted on the web originally, as opposed to JavaScript?

Since my previous question was closed (https://stackoverflow.com/q/62354455/1173166), I thought this would be a better place to ask the question. Original: JavaScript we designed specifically for ...
-3
votes
1answer
45 views

Does using a destructured object as function arguments make sense?

Once upon a time we did this /** * Function that does lots of things * @param {boolean} state * @param {number} max * @param {string} set * @param {number} timeout * @param {boolean} bail * @...
10
votes
7answers
2k views

Should you make use of 'accidental polymorphism'?

Sometimes I find myself in situations where just by happenstance two things can be treated the same way. But they aren't truly the same, it's just coincedence. Let me give an example, imagine we are ...
0
votes
2answers
91 views

How to handle different types of errors in Clean Architecture?

So, in the process of creating a user there are 4 possible outcomes: Username is already taken Email is already taken Username is invalid Email is invalid Here is what I have in the controller for ...
-4
votes
1answer
39 views

Message Strings in Backend

Its ok to have hardcoded strings on backend? Example: Log.e("Error connecting to the database") The text "Error connecting to the database" should be hardcoded there? Or should it be in a separated ...
1
vote
2answers
70 views

Where should I put the .scss files in the scaffold?

I have developed an open-source vue.js scaffold which is based on my exprience and study on various vuejs projects. Currently it has a good structure(i think), but i'm nervous about is it good ...
-1
votes
1answer
72 views

Good representation for list of items that can be grouped together

I am building the frontend of a web app in JavaScript that manages list of past events. It basically has the following requirements: Events are displayed in a vertical list. Events can be moved to ...
0
votes
0answers
46 views

Conditionally filtering dependency-injected async data?

I have a NodeJS application which I've built around dependency injection. The app can run any combination of its functions (modules) at the same time, and any modules that request data from the same ...
-3
votes
1answer
38 views

Do I need MongoDB (or another type of database) to authenticate with Google?

I'm creating a web application using Node.js and Pug, and have recently been looking at adding external OAuth authentication to this site, using Express and Passport.js. I've found a lot of examples ...
-2
votes
1answer
52 views

Is there a less complicated alternative to handling this simple mySQL query in Node?

To Put My Question In Better Context... I am about done writing my first real-world Node application, which would be classified as a REST API. For myself, it was a bit challenging to wrap my head ...
1
vote
2answers
50 views

Suitable way to round results returned by any function of a class

Assume there is a class Shape. The class has two functions area() and perimeter(). Let's say Circle and Square inherit from Shape and override these methods. Obviously the results are going to be ...
-4
votes
1answer
37 views

Best way to structure reusable code using Node.JS, EJS, and front end JS?

I'm more or less learning the MEAN stack (have yet to start on Angular, so currently using straight vanilla JS for front-end) and part of what I'm building for my portfolio is a drag-and-drop form ...
-3
votes
4answers
241 views

Is it possible to prevent tech scammers from editing bank webpages?

In a refund tech scam, tech scammers use Chrome Developer Tools to edit the HTML directly on the victim's bank webpage through a Remote Desktop (Teamviewer, AnyDesk, etc) to fool their victim into ...
3
votes
1answer
95 views

What is the expected performance of While loops using `array.pop()` assignment vs other methods

Recently I was asked to refactor some code that leverages JavaScript's array.reduce() method because other developers felt the code hard to read. While doing this I decided to play around with some ...
0
votes
3answers
131 views

React - When is a backend necessary?

So I'm currently playing around with web development as a project, and I've been looking at React recently. My current issue is that I'm having trouble distinguishing between front and back end ...
-2
votes
1answer
118 views

Is frequent use of bind(this) in Javascript a code smell?

I am doing a project for a client where I am getting my first real heavy, hands-on exposure with Javascript. Since I have learned about adding .bind(this to callback functions, I find I am doing it ...
-2
votes
3answers
63 views

Is there a secure way to ensure a data in an API endpoint of mine came from an Instagram endpoint?

Is there a way through encryption/keys/jwt or anything else to ensure that the data being sent through a POST request is only data coming from another request I made on the client to a 3rd party ...
-4
votes
4answers
93 views

What are use cases of using optional for loop statements?

I don't think any of them are good practice. In addition to that they make the code longer. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for Optional initialization ...
0
votes
3answers
156 views

Using the symbol ⎋ to denote any “escape” in Javascript, CSS, HTML etc

I know that: Computer keyboards have an Escape Key The symbol for the Escape Key is U+238B Broken Circle with Northwest Arrow (⎋) and I also know that: HTML5 & CSS3 both have escape characters ...
-4
votes
2answers
61 views

Should I prefix keys of JS object with the object's name?

Let's get to an example. Suppose, I have a Course object with the following properties: (course' code, course's title, credit of course etc.). When expressing this as a JS object, I can do it in the ...
0
votes
1answer
68 views

When does it make sense to update eslint/prettier?

I have the following setup: different teams shared eslint config (that imports airbnb rules as a basis). Whenever a developer decides to update libraries, if eslint/prettier have updates, it's a ...
0
votes
2answers
91 views

What approach do I take to unit testing a class which has a method that internally calls other methods?

I have a class which has one method that is called from another class. This method internally calls several other methods to do its work. Those other methods are all public and can be called by the ...
-5
votes
1answer
42 views

What is a good book to learn JavaScript for complete beginners?

I could not find a good book for learning JavaScript. I Googled but most books seem to assume that you have some programming experience and don’t teach from the ground up. They assume you should know ...
-2
votes
1answer
55 views

Design pattern for a switching between APIs with no code changes

I'm trying implement in JavaScript/Node.js a data upload functionality. I want to be able to switch between different storage providers, e.g. AWS, GCP, Azure, with no code change, for instance, via ...
1
vote
2answers
96 views

React says refs and imperative code are not the right tool for showing and hiding dialogs. Why though?

The docs explicitly state this: Avoid using refs for anything that can be done declaratively. For example, instead of exposing open() and close() methods on a Dialog component, pass an isOpen prop to ...
4
votes
3answers
256 views

Testing unexpected inputs for unit tests and loops?

I'm working on an enterprise that has some Angular/Typescript projects and to avoid repeating code (basically copying and pasting) between them, we decided to go for Monorepo and start write an util ...
1
vote
2answers
55 views

How to pass variable to function that may or may not be available based upon options?

I have a question and it is quite simple. Here are the details: I want to pass an options object into my mainFunction and some other functions inside of it, i.e. someFunctionCall and ...
1
vote
1answer
40 views

How could I optimize an AJAX-based site by avoiding unnecessary/duplicate file-reads for each AJAX call?

I'm an IT guy (read: not a professional programmer) and have made an internal monitoring webtool which allows users to search for printers on our print servers. Based on the filtering criteria given, ...
1
vote
1answer
70 views

How to update HTML/JS client from PHP server without refresh intervals?

I am building a simple client-side web page that can be updated from an admin page. I am using PHP for server-side manipulation of the client targeted page. The setup feels like an overkill to me: ...
2
votes
0answers
45 views

Javascript module design patterns

Partly for use in my own projects, and partly for fun while being stuck at home I'm attempt to build yet another "block" based editor. So far I've been using simple objects, starting with a global ...
1
vote
1answer
42 views

Angular Folder directory approach

I know the proper folder structure for an Angular application should be like this: /app /core module /components /services /feature module /components /...
1
vote
0answers
73 views

Single page dashboard architecture

I am implementing a dashboard. I figured I'd make it work like a SPA for cleaner flow and better performance. When you click a sidebar link, the page/section gets loaded with AJAX. You can still ...
3
votes
1answer
38 views

Storing username and password for another site in Node and MongoDB

This is not about storing my user's login details in the app, I already use hash and JWT tokens for that. There is a part of our app where we need to store the login details of the user for another ...
2
votes
1answer
122 views

How to structure OOP multiple calculations?

I am working currently on a project that requires a series (almost 86) calculations to run based on a user data input. The problem is that each calculation has a series of requirements: Should be ...
0
votes
1answer
77 views

How can I store time series data like Google Analytics, Facebook, etc?

I'm thinking about this in terms of a No SQL database, more specifically MongoDB. So, I want to build something like Google Analytics where I will be taking in a ton of data and when it occurs so I ...
2
votes
3answers
138 views

How should I store time stamps so that it's easily accessible and won't take too much space

tldr at the bottom if you don't want to read all this! :) First of all the db I'm using is MongoDB! So I've been building a fun project and all has been well but I hit a small problem. Effectively, ...
1
vote
2answers
192 views

What is the right algorithm to match regex on a stream?

I'd like to match a regex pattern on a stream, but I am not sure what algorithm to use. I certainly don't want to load the entire file into memory. I tried to figure out how to do this, but I have ...
1
vote
1answer
55 views

Building a form based on json object?

I'm currently refactoring an older legacy application and use React to rebuild some of the former functionality. This application has a form which has +10 different input fields. The aim is to kind of ...
0
votes
1answer
39 views

Organizing Parallel Arrays of Promises / Async tasks

I'm struggling a bit for a preferred way to organize a sequence of asynchronous tasks that can be applied in parallel. Say, you are parsing data from many files. In my case I'm using javascript and ...
-2
votes
1answer
33 views

Can a JavaScript SPA launch executables installed on the server?

Context We have an application that is written in .NET and runs on a Citrix server. This app consists of shortcuts to external tools (like: DameWare, VNC viewer, mtsc.exe, msra.nexe, ...) that are ...
1
vote
1answer
316 views

How to explore a deeply nested object structure more easily?

An example to show what I mean exploring a deeply nested object structure. This is a real code I deal with today (it is vue but that is irrelevant to my question) data() { return { ...
1
vote
1answer
68 views

Memory management in node.js

I'm writing a web server as a test project in node.js Whats really bothering me so far is the lack of control or even awareness of memory usage. Naturally I want to cache some stuff in RAM for faster ...
1
vote
1answer
47 views

Tips for module naming and criteria for grouping files in a directory

It appeared, that I have in my pet project two abstractions: asset loaders and drawing tasks. For each abstraction I have some classes representing them (currently a single class for drawing task ...
1
vote
0answers
48 views

How could I reuse common JS modules between several projects?

At my company, we are developing pretty simple React Native and sometimes mobile-only React apps. Most of them have some similar logic, such as 'sign-in by phone' flow, some payments stuff, etc., and ...
-2
votes
1answer
49 views

React class or function for stateful components?

Which is better to use? react class based stateful component or react hooks functional stateful component? I've searched a bit but couldn't find what is preferred to use.

1
2 3 4 5
40