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.

138 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
46 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
54 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, ...
0
votes
1answer
251 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: { ...
0
votes
1answer
113 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 ...
0
votes
0answers
360 views

What is the cleanest way to model my domain in JavaScript?

I am building an SPA. It will use WebGL, Canvas and SVG for certain components, and html for rendering views. I have a messaging system setup to define messages coming from a server, which will get ...
0
votes
0answers
589 views

How to design the state tree using redux?

In the last days I have searched for a documenation on how and when is it best to use redux and how to design the state tree. My research ended in the conclution that there is no one currect answer. ...
0
votes
0answers
94 views

AngularJS: cost of deep watching infrequently changed object trees

I am working on a complex widget with a "preferences" object tree with 50-100 objects and 3-5 properties in each object. Each property is watched by Angular and controls how some aspects of the data ...
0
votes
0answers
107 views

coming from java to nodejs whats the convention for error handling logging? e.message or e.stack?

I come from java, when I got an expected error I printed stack traces. I'm coming now to work on nodejs (never really worked on javascript). and in the nodejs project which I need to maintain (...
0
votes
0answers
230 views

Why doesn't Object.prototype.toString produce more meaningful output?

Why doesn't Object.prototype.toString return a string representation of an object? I don't see any use for the current output and it seems that it would be more useful for the toString function to be ...
0
votes
0answers
253 views

validating arguments in javascript constructors

In many cases, it is useful to have a constructor or factory method that validates arguments before instantiating an object, returning a new object if the arguments are valid and null otherwise. But ...
0
votes
0answers
76 views

Localizing a web-app

I'm just having a debate about the best (future-proof, safe, user-friendly, developer-friendly, technologically nice) approach to localization of a web-application. We are using basically processing ...
0
votes
0answers
59 views

Syncing file data and form data uploaded at separate times

I have a web application where users can upload office documents. In addition to uploading files users also specify extra information about them that's not contained in the files themselves but is ...
0
votes
0answers
240 views

Persisting and manipulating JS ArrayBuffer data on the server

My node.js app has to deal with (sometimes large; a few MB) tables of numerical data. I'm about to use JavaScript's native binary objects for this purpose (i.e. ArrayBuffer and friends), because they'...
0
votes
0answers
81 views

Vertical Single Page App libs/patterns?

Lately I've noticed a trend amongst some website homepages to present information in a vertical fashion, forcing the user to scroll down to continue reading the content. As you scroll down, a state ...
0
votes
0answers
143 views

Right way to design javascript flow?

My question is because I believe that maybe there is a better way to design my code when I need to do sync tasks in JS and wait for the response. I'm working on Node and I need to save some data (I ...
0
votes
0answers
851 views

Reason why client-side JavaScript does not allow access to POST/PUT/etc contents

Is there any theoretical reason why client-side JavaScript could not be spec'd to allow for direct access to POST or PUT contents without need for a server language to write it into client-side ...
0
votes
0answers
103 views

Login Tokens Remote DataServer for use in a Javascript/HTML-PHP environment

I've asked this question on stackoverflow, but i think this is a more appropriate place for it. I'm creating an app for iOS, Android and the Web. I created a separate Restful Data Service that is ...
0
votes
0answers
618 views

Javascript and SQL Lite (multi browser offline SQL/database query)

I'm in the elections division of my county and am trying to simplify a voter lookup method for our poll judges during election time. Currently we are using a clunky heavy application that the judges ...
0
votes
0answers
217 views

Keeping Backbone model in sync with editable view

I'm making a web form for editing some objects. I'll call these objects Foos. I have a Backbone model that represents Foos. I have a Backbone view that renders an editor form, filling in fields ...
0
votes
0answers
441 views

What is special about JDBC that makes it unlikeable for JavaScript

Quoting from Selenium Architecture A natural implementation would have been to provide a database connection to the underlying data store, using something like JDBC. Eventually, we settled on ...
0
votes
1answer
158 views

Using custom mime type for drag'n'drop events or data attribute dilema

I am having a dilema on a html/js application I have been requestyed to handle drag'n'drop events in order to display a dropped image in a div if is not from images that are already displayed in my ...
0
votes
1answer
694 views

AngularJS and NodeJS required version

I am new to the world of Javascript and their frameworks, and I feel a bit lost with this. I am trying to follow the official toutorial of AngularJS. In one of the first sections, it reads Install ...
-1
votes
1answer
34 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
1answer
115 views

Design ideas for showing another website's page in my own website

I would like to show a web page from another website and show it on my website. I want to annotate some text on their website content. Conceptually I know what needs to be done: - I will capture their ...
-1
votes
1answer
3k views

How to get machine client information from web application?

I am writing a ticket system in PHP(with Laravel) for about 350 users and around 200 machines. I know that already are good solid solutions available, but I'm doing some very useful projects to learn, ...
-1
votes
1answer
323 views

I'm building an app with Node, Express, and MongoDB. Is AngularJS necessary?

Node, Express, and MongoDB are really connected so I can understand why they are frequently used together. For a web app of medium complexity, can I get away with only using HTML/CSS and EJS for the ...
-1
votes
1answer
281 views

Strategy To Upgrade Frontend Javascript Code - Typescript or New Framework?

Here is my scenario. I would like advice on which path to follow, along with good reasons as to why. It would even be better if you could give an example based on experience of a similar decision but ...
-1
votes
2answers
300 views

React.js + Flux, immediate response during history back/forward

In Instagram (web), when you click back/forward arrows - I've noticed that the content isn't loaded from the server and it immediately show up. After reading the docs on react.js + flux, I had this ...
-1
votes
1answer
334 views

Synchronous architecture with asynchronous repository

In order to keep clean architecture of my node.js microservice I have controllers, services and e.g. repositories. I want a synchronous data flow: controller -> service -> repository -> service -> ...
-1
votes
1answer
253 views

JS Asynchronous Load Pattern

This is a specific problem but I believe the pattern here may be general enough to be useful to the audience here. I'm working on an offline JS application. In my JS application, I would like to run ...
-1
votes
1answer
125 views

Does avoiding Promises and Async leads to clean code?

While applying for a job interview I found this line in requirements. Experience with clean code writing practices like avoiding callback hell like promises, async Does this line make any sense ? ...
-1
votes
1answer
128 views

Three.js Screen Tear

Using Three.js Revision 51 (Yes I know the latest is 84) I am getting a screen tear at random times on the load of my page. It seems like it's 50% whether it's a hard refresh or a fresh load of the ...
-2
votes
0answers
66 views

How to avoid circular references in JavaScript?

I have two classes. A Bot class and a Client class. Heres a relevant section of the Bot class. class Bot { constructor(client) { this.client = client; this.client.on(ChatEvent....
-2
votes
1answer
659 views

Add method to existing class you don't own in javascript

Is it still called monkey patching if you are only adding new methods instead of changing existing method behavior? What is this called? Example: String.prototype.contains = function(needle) { ...
-2
votes
2answers
195 views

How to find all occurrences of a variable within a source code?

The title is pretty self-explanatory. I have a minified JavaScript code (100k+ lines) and would like to find all occurrences of a particular variable so I could rename it to better understand code. Is ...
-3
votes
1answer
94 views

Is there a best practice for naming class selectors for identification alone

Is there a best practice for naming class selectors for identification alone? For example, for defining a single amount field with action button, we end up creating several div containers and div ...
-5
votes
1answer
782 views

What are the benefits of using Jasmine Framework on existing applications?

I got one project which contains JavaScript code. No unit tests were written for JavaScript code. So it is feasible or beneficial to write unit test cases using Jasmine Framework for code? What are ...
-5
votes
1answer
1k views

How to compare and replace value from two object inside array?

Here i want to replace price in data1 to price from data2, and it updated if the id is same. Is it possible to do that without nested loop? var data1 = [{ "id": "56e641d4864e5b780bb992c6", ...