Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
0
votes
1answer
107 views

How to build a data-driven menu in JavaScript?

I'm going to attempt to build a data-driven menu for my web-app. The goal is to be able to serve different menu options to different users from an API. The hope is that the server could return a ...
-3
votes
1answer
5k views

How can I do to use Angular 5/6 for frontend and Codeigniter 3 for backend in the same web app?

I have this project I want to do, using Angular 5/6 for frontend and Codeigniter 3 for backend. The problem is that I don't know how to combine the two, and all the tutorials I looked were using ...
0
votes
1answer
2k views

What's the difference between “foo.spec.ts” and “foo.test.ts"?

When I use Angular CLI to generate a component, the test linked uses the logic foo.spec.ts. I am reading a tutorial where the test linked uses the logic foo.test.ts. What's the difference between “...
0
votes
2answers
435 views

WebSockets vs Ajax call for scheduled event?

Intro I have been weighing the pros and cons of using WebSockets vs. an Ajax call for an event which will happen every x number of seconds (in this case 5). I'll start by explaining the scenario. ...
2
votes
1answer
495 views

Best practices for calling multiple APIs and manipulating data before showing it to user?

I am building a web application that makes use of multiple API's (Google Maps, Weather APIs, and more). I am using Python + Flask on the backend, and Javascript (probably with React, I have not ...
2
votes
1answer
99 views

What is the advantage of flattening dependent Promises

I've read that nesting Promise continuations is bad practice. For example, here. GetCustomer().then(customer => { ProcessCustomer(customer).then(processingResult => { console....
1
vote
1answer
41 views

JavaScript/NodeJS Class Extension vs Adding Properties

I am currently writing a Discord bot and have reached the point of needing a refactor. With this being my first stab at JavaScript/NodeJS and making a bot in general, there are a lot of mistakes I ...
0
votes
1answer
56 views

Privacy in prototypal inheritance

People say that everything in The prototypal inheritance is public But we can achieve privacy using closures in the constructor right? function Cons(id){ this.name='Hermit'; this.check=function(){ ...
0
votes
1answer
280 views

Organizing reducers in Redux

I will use the following popular todo list example for demonstration. Let's say I wanted to create a very basic todo list with this structure as the app state: { todos: { todoKey1: { ...
-1
votes
1answer
163 views

Is it bad practice for a composited instance to reference its parent? If yes, why?

I'm building a Selection class that holds and allows manipulating selected Items on a canvas. The Selection is part of the Document, the top-level app-container if you will. I'd like to be able to ...
-3
votes
1answer
68 views

Creating a multiplatform (IOS, Javascript, and JAVA) linked user account database

I have done weeks researching this question for my App Idea. Background of the APP - Simply a multi crypto currency wallet which users sign up with ONLY username and Password - no email, FB, or ...
-1
votes
2answers
680 views

How does a dynamic array access work?

In C if i declare int x[4] Which tells me its an integer array with each array element size fixed of size 4. So after initialization when I access x[3] : address of array +element size which is 2 *...
-1
votes
1answer
87 views

How to develop larger client-site in-browser apps in javascript?

I'm new to javascript environment (I have background in C++ physical simulations and game engines). With rise of HTML5 and WebGL I was thinking I'd like to try make some games/3D editors using ...
0
votes
3answers
224 views

less functions and complex code or more functions and readable code?

I am currently making an html-based editor, i know there are lots of editors out there especially html based but i want to do it myself once. What i am concerned about is, for e.g, when a user press a ...
1
vote
0answers
382 views

Should Flux mutation logic always be done in the store, or can it be delegated to a class?

(I am using Vuex but the question applies to any Flux architecture.) I don't have a great understanding of the reasoning behind Flux architecture. I understand that it is nice to have all of the ...
1
vote
1answer
116 views

How to handle dependency between two unrelated objects?

I am trying to figure out a way to solve the following dependency problem. I have a parent object DomManager that has the responsibility to handle all the interaction with the DOM. It initializes ...
0
votes
2answers
72 views

I have two different account types that can do different things in a Single Page Application. Should I turn it into a Multiple Page Application?

In my new SPA (Single Page Application), I have teachers, which can make tests, and students, which can take tests, subscribe to teachers, and view their grades. This means that in JavaScript, they ...
0
votes
1answer
936 views

How to impersonate user in web app?

I am building an intranet web app with ASP.NET. We are using Windows authentication for granting access to different web pages. We grab your Windows login server side, then build web pages ...
-5
votes
5answers
259 views

I learnt a languge suppose (Java). I also know python. I want to write a simple app. Is there any way to run both language same Time?

I had been learning python and i know Java. if i were to write a simple program, can i write both programming language in one document or compiler? I got into this problem because if i cannot merge ...
0
votes
1answer
271 views

Class definitions in static getter methods

[Node.js / CommonJS] I'm creating a single GitHub repo for my tool which has a Core, Control, Server, and Client library. It's unlikely that all of them will be used at the same time. I'd like my ...
0
votes
1answer
267 views

Why “typeof null == object” will stay in javascript?

I was reading a article about front-end development on Medium, when I stumbled upon an interesting piece of information, which is as follows: The type of a variable can be determined by using the ...
2
votes
1answer
81 views

Are there standards for handling card swipers in applications?

I'm in the middle of creating a web application for a client, and he wants me to integrate magnetic card swipers so his office staff can quickly swipe a card, and load up details for specific patients ...
1
vote
1answer
578 views

Chat application - write to file and then save in database

I have followed this approach that is described here to implement a simple chat application: https://code.tutsplus.com/tutorials/how-to-create-a-simple-web-based-chat-application--net-5931 I'm ...
0
votes
1answer
163 views

Why the methods of the Object Constructor do not work on DOM Elements

//------------ let person = { name: 'John Doe', age: 22 } let e = document.getElementById('task-title'); /* Object.getOwnPropertyNames() Returns an array containing the names of all of the ...
1
vote
1answer
77 views

How to make a secure web-app account system?

i have some experience (mostly as a student) with react and redux, and on the other hand i also have some experience with express, normally for my apps (all of them are really simple) i make a rest ...
1
vote
2answers
173 views

HTML and JS code structure

I am relatively new to HTML/JS and am very much an amateur programmer. I have created a web app that works but I can't help but feel that the code is a spaghetti mess! I have been looking for JS/HTML ...
1
vote
0answers
58 views

Is this a good solution for Card holder applications?

Business case I am currently looking for a better architecture to replace the current implementation for my application. Currently, My application runs on a mainframe system with CICS used for ...
1
vote
0answers
101 views

If you name the functions on a “factory class” and then invoke them statically, is still a factory?

Let's take the following Javascript, but the language is not really relevant: module.exports = (user) => { return { createPrimaryConfig: () => { return new Config('a', 'b', ...
4
votes
2answers
713 views

Benefits of using a JS Framework

I am starting a new project and trying to decide if I should use a Javascript framework (like vue.js or react) and create a Ruby on Rails API, or use Ruby on Rails to server-side render pages and ...
0
votes
1answer
252 views

JS Captcha in contact form validation to avoid spam bots

I am looking for opinions about how bulletproof could be this captcha system to avoid spam in a contact form. The form submit goes through ajax. So I generate 2 random numbers with javascript. The ...
2
votes
2answers
115 views

Better method to adding lots of options in a function

I have a JS function that takes JSON data and creates an HTML table. As my project developed, I needed one specific table to be created with a button - so I added an option to the function and an ...
1
vote
0answers
123 views

Design differences in Angular UI components and regular JS UI components [closed]

I'm an experienced JS developer and I've been involved in front-end development for multiple web applications. I've developed a couple of custom JS components to suit the project. I'm currently tasked ...
8
votes
3answers
665 views

Communication between decoupled components using events

We've got a Web App where we have a lot (>50) of little WebComponents that interact with each other. To keep everything decoupled, we have as a rule that no component can directly reference another. ...
7
votes
4answers
2k views

Best way to do Client side authorization for a single page JavaScript application?

I already have a solid back-end permissions authorization (ie. admin can perform an action, a normal user cannot perform an action). However, I'm wondering if there is a better way to do a frontend ...
0
votes
1answer
111 views

Serialized Object Representation in Javascript from PHP

Let's say I have a Widget object that I serialize and send back to the browser at a regular interval. This Widget object includes lots of different members (variables) and other objects along with ...
0
votes
1answer
98 views

Is creating near duplicate partial views solely for populating html elements with Ajax returns violating DRY?

Maybe anti-pattern is a better word for this question. I do not know, but I mean a violation of DRY. Id like to reuse a partial view, and I can, but that partial view has other things in it I don't ...
16
votes
4answers
1k views

Unable to solve mystery of functions in Javascript

I am trying to understand behind the curtain scenes of Javascript and kind of stuck in understanding the creation of built in objects, specially Object and Function and the relation between them. ...
0
votes
1answer
80 views

Ext JS: Designing a base class and override it

I'm trying to define a base class and override it's items on different inherited sub-classes. I'm following MVVM pattern to fetch records from backend. Created several stores and formulas within ...
0
votes
2answers
219 views

Architectural Problem in use of ToneJS with Vuex

I'm using the Tone.js library to build a (music) sequencer in Vue+Vuex, and have encountered this problem: Individual music tracks of the sequencer are created dynamically, so I'm storing objects ...
0
votes
1answer
141 views

What would be more efficient, move DOM elements or clone them?

I have this dilemma, I have to make a menu, the basic estructure is four to six main menu items and each one can have N level 2 menus and each sub menu can also have subs. I get from the server this ...
1
vote
0answers
156 views

Understanding transducers, why this is not a transducer

I'm currently learning functional programming and trying to learn a new concept : transducers. I'm actually getting the point of theory, like it's an advanced map/reduce that aims to provide better ...
3
votes
1answer
142 views

What is the standard method of handling errors in a NodeJS web app?

I am currently working on a web application as a learning project, which has a NodeJS backend and uses a MongoDB database; however, I believe my question is not specific to the technologies I am using....
0
votes
2answers
87 views

How should I dynamically retrieve data depending on the size of the user's browser window?

I'm developing a chat module for my employer, and one of the requirements is that I "get enough backlog to fill the screen" when opening the room, instead of always limiting it to a specific number ...
-4
votes
1answer
93 views

What is the truh concerning pasting data into a browser? [closed]

I am hearing a ton of different info. I just found this in a site The 'paste' operation in the context menu or button press is not possible. It is not possible because of a browser security ...
0
votes
2answers
60 views

How inject a collaborator who needs a back reference into a constructor

Following Hevery's advice to inject collaborators into constructor rather than new'ing things within constructor body, how gracefully do this when a collaborator needs a back reference to its owner, ...
1
vote
0answers
248 views

Front-end-side encryption: Where to store password throughout session?

currently we're working on a small application where we store a bunch of JSON data coming from a JS-based graphing editor (think of a spiced-up version of this) in a Rails-based backend. We want to ...
1
vote
1answer
1k views

Is it a good practice to log client side errors to a file

I basically want to know if it is considered a good practice to persist the errors that happen on the client side of a web application (typescript/angular for example) by logging them to files? Or if ...
2
votes
1answer
59 views

Realtime Live Auto updates for web applications

It's about trying to understand the architecture behind how updates to web application is done. I've been working on a non-public website that has bunch of records displayed in a UI, now the ...
3
votes
1answer
4k views

element.style.setProperty(property, value) vs element.style.property = value [closed]

I was wondering if I should use element.style.setProperty(property, value) or element.style.property = value. I am very much tempted to start using element.style.setProperty(property, value). But in ...
0
votes
3answers
2k views

Should I generate GUID/UUID on client or server?

I want to generate a GUID/UUID for my web app to use but I'm not sure if I should generate it on the client or server or what should be the preference. Basically, I'm working on a web app similar to ...