Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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-...

-4
votes
0answers
20 views

Struggling to create a responsive website header that works on mobile too

Hopefully this is the right place, apologies if it is not. I've been trying for hours and can't find anything useful on the internet but I've seen them used frequently. Initially I had created two ...
0
votes
0answers
95 views

Why don't browsers protect against memory leaks from web pages scripts? [on hold]

I just found & reported a memory leak issue on a website. When i tried to load the page, my system's RAM filled up entirely in about 5 seconds, after which the swap space began to fill up at a ...
1
vote
1answer
53 views

How can I avoid using global variables in simple Javascript SPA?

To learn Javascript I am building a simple Single-Page Application. It is a basic slideshow app that needs only to process some basic settings and execute some behaviors. The basic structure of my ...
0
votes
0answers
31 views

JS ecosystem - In which oder I should learn them?

I'm migrating from Java to JS and I would like to know what is the best way to do it in the field of JS ecosystem. After reading all the You Don't Know JS series by Kyle Simpson, I would like to ...
0
votes
0answers
27 views

Codeigniter Notification System URL Structure

First I apologize for my english. I am trying to develop a facebook-like notification system with Codeigniter. I know it's much better technology, but it's not about using them right now. The ...
0
votes
0answers
56 views

Difference between two ways to throw an error

I saw a very special (and weird) error handling code, which goes like this: function SomeError(name, message) { this.name = name; this.message = message; this.stack = (new Error()).stack; ...
1
vote
1answer
69 views

Simulating Comparison Without Using Comparison Primitives

In the same way that you can simulate the if statement and functions, I am wondering if there is a way to simulate the comparison operators ==, !=, >, >=, <, <=. For example, in ...
1
vote
1answer
28 views

OrderedMap or List for Redux structure?

I'm implementing a Redux store for a React app using redux-saga for API calls. I've used Immutable.js before for other Redux-using React apps but the nature of previous projects always evidently ...
0
votes
2answers
143 views

Why Unicode Encoding/Decoding is Necessary in JavaScript

I am wondering why unicode encoding is necessary in JavaScript. I am looking at utf8.js as an example. I am also looking at the utf8 spec, but am not really following the different pieces of data. ...
1
vote
2answers
51 views

Meaning of Using BitVectors to Model Integers to account for Overflow

I have just encountered this sentence: Depending on the context, we may prefer to model integers as bitvectors rather than mathematical integers, since the Int type does not model overflow. I am ...
0
votes
1answer
112 views

Is the usage of flip function a smell for bad design?

Everything is in the title, is the usage of flip function a smell for bad design ? I'm coming from a JavaScript universe and used to work with lodash/fp or ramda. Recently, I've written some stuff ...
0
votes
1answer
67 views

Should I print to the page from a javascript object, or only render from PHP?

I have a complex app on the Javascript/PHP/SQL stack which manages different domain objects. The Javascript layer contains classes which manage the data on the client side. I am currently baking a ...
-1
votes
0answers
36 views

Should I use Next() convention or Done()

I'm designing a new Node.JS web framework. It's partly based off Express.JS but I have changed core functionality. I'm stuck on a design decision and having analysis paralysis. In express, one would ...
0
votes
0answers
46 views

Adding new parameter to Javascript function

What do I pass in for the existing arguments that have no value, undefined or null? Existing function foo(a, b) is called like foo(1) and foo(23, "hi"). After adding a new parameter, it's foo(a, b, ...
-1
votes
1answer
32 views

Tools for generating a form from a schema, and applying process flow logic

We have a situation where the business has a range of datasets which end users contribute to. The business needs flexibility in adjusting or rather extending these datasets, and also publishing new ...
-1
votes
0answers
52 views

Use jQuery with Vue and Typescript (and mixing other libraries like react)

React and vue like libraries are best fit when it comes to data binding (one way or two way). But jQuery really requires when dynamic styling is needed. (i.e. set height of element based on window ...
0
votes
0answers
54 views

Does putting javascript in my JSP file make it impossible to test?

The project I'm working on has lots of JSP files, some of which have javascript script blocks scattered throughout and some of these scripts interact with other javascript packages that are served ...
-1
votes
1answer
128 views

How can I prevent my API from being accessed by anything but my website?

I've got an API (Java + Play Framework). I've got a website (React) who has to communicate with the API. I don't want my API being called by anything but my website. How can I do?
0
votes
3answers
129 views

How to Simulate Control-Flow without using Control-Flow Primitives

Basically, I want to know how to simulate while and if if I'm handling the control flow myself through an array of instructions. The while loop can be simulated by if, as seen with assembly branching ...
0
votes
0answers
32 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
228 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 ...
-1
votes
1answer
58 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
98 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. ...
0
votes
1answer
119 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
74 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
34 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
49 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
0answers
20 views

Interruptable/resumable sequence of actions in client-server game

I'm implementing an online turn-based game, where game state changes are driven by client actions sent to the server. Valid client actions are generated and validated by a values method, which takes ...
0
votes
1answer
33 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
145 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
60 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 ...
-2
votes
2answers
133 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
79 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
210 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
125 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 ...
0
votes
0answers
48 views

Best way to work with existing Nodejs project with code smell and bad design? [duplicate]

I've read a few questions on here about inheriting legacy code, and how to proceed with writing new code, and refactoring. I'm just uncertain if what I'm currently doing is the best practice. The ...
1
vote
1answer
104 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
70 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
0answers
39 views

Designing currency exchange class

I am writing a small library to get the currency exchange rate, at present the data is being gathered from European Central Bank which provides exchange rates from EUR. The rates are updated daily ...
0
votes
0answers
24 views

planning class schedule web-app

Hi I'm new to JavaScript and developing web-app but I'm taking on a project (to improve my skills) and I need some help/suggestions So the web-app is a class planner. I'd have a time table with days ...
0
votes
1answer
235 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 ...
-4
votes
5answers
230 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
80 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
0answers
32 views

Building a graphql api in php, async or not?

Coming from a previous task of building a graphql api in node I was asked to do the same thing for php. We started defing the components/tooling of our project and we went for what we know best in the ...
0
votes
0answers
43 views

Architecture question with specific use-case (Web Development)

I'm new to web development and looking for ideas to build the following prototype. My requirement is to display near real-time stock market data via charts that are updated automatically every five ...
0
votes
1answer
90 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
79 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
178 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
79 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
69 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 ...