JavaScript is the original and common name applied towards most flavors of a scripting language that originated on NetScape Navigator. Use this tag for questions regarding common implementations of ECMAScript, JavaScript, JScript, etc. JS does not typically refer to its ECMA-cousin, ActionScript.

learn more… | top users | synonyms (1)

-2
votes
0answers
13 views

Finding and handling all the corner cases while writing a os dependent library

I need to know what is the best strategy while developing a public facing API that handles manipulating files. What error conditions I may need to handle? Reference: https://github.com/vivekimsit/...
0
votes
0answers
35 views

Is it worth working on Google Closure now

I'm evaluating to whether to include this in my workflows. My workflow for JavaScript tools include and they offer me following. WebStorm (Excellent Code hinting, JSDocs comments, Refactoring etc.) ...
1
vote
1answer
88 views

Why does array.push() sometimes take more time in Javascript with Google Chrome

A while ago I've made a simple script in Javascript that tested how much time it takes to add elements to arrays. I've used 3 different methods: array.push(), array[array.length] and array[x] where x ...
0
votes
0answers
41 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
vote
0answers
54 views

JavaScript - Clientside seperation of Model and ViewModel?

I am developing web apps using the Model-View-ViewModel approach with Knockout.js. After reading on the original introduction of MVVM by John Gossman, I realized that my ViewModel always contains ALL ...
0
votes
0answers
46 views

How to handle ID's with resources that can be combined?

Early on in my app, there were simple Customer objects with an int id. In my database, some customers are split into multiple accounts for organization purposes. For ex. "CustomerA" (Main account) (ID:...
0
votes
0answers
21 views

Javascript : Handling multiple API Requests (Adobe Analytics)

I have a requirement to build a enterprise dashboard where data from various digital assests (around 20 primary websites, mobile apps) of our company can be presented. This data is already stored in ...
-2
votes
0answers
48 views

How to read a remote txt file with Javascript and write contents to html document [closed]

After some research i've only come up with this HttpRequest with standard javascript. var txtFile = new XMLHttpRequest(); txtFile.open("GET", "http://www.suko.tv/Sounds/oh.txt", ...
1
vote
3answers
125 views

Unlike C++, why does uncaught exception in JavaScript not terminate the script?

As someone used to C++ and new to JavaScript, I find this behavior odd. Whether a program runs directly on the platform like C++ ones, or it runs at a higher (or deeper?) level like JavaScript ones, ...
0
votes
0answers
40 views

How to avoid multiple long polling request from chat app

I am building a real time chat app for eCommerce app customer-seller. As I am using long polling Technic. I need to understand how can I optimize multiple long polling request. For eg. I am a ...
-1
votes
0answers
23 views

Dependency Injection framework for TypeScript and JavaScript (es5) [migrated]

I've been looking for a DI framework that works well across TypeScript and pure JavaScript (es5). I've come across some implementations, such as Inversify and Angular's 2 DI. However, Inversify seems ...
0
votes
1answer
53 views

Recommended strategy for changing javascript UI table library?

tl;dr - On an existing angularjs grid library, am moving to another. Is it better to wipe out as much code as possible and in a sense code from scratch to the same featureset, or work around what's ...
1
vote
1answer
57 views

google maps API key for clients

Google API key is now required for new websites even for a single map embed. How are you going to handle this? I guess the correct way should be to ask a client to create his google API key and send ...
3
votes
3answers
339 views

Is it faster to make a dedicated variable instead of calling deeply nested object several times?

In a JavaScript app, suppose I have a nested object like this: var myObject = { someProp: { someOtherProp: { anotherOne: { yetAnother: { ...
7
votes
6answers
646 views

How are large JavaScript applications supposed to be structured?

I've recently been shown some JavaScript plugins written for OBIEE Mobile App Developer, as well as some custom libraries for various projects. Coming from an OOP background, I am a little confused ...
0
votes
2answers
116 views

How to 'read' arrow functions in ES6?

I've been trying to learn some of the new features of ES6, and while most of it makes sense, I'm having trouble grasping the arrow function. I'm not asking so much why it exists as I am how to read it....
-1
votes
0answers
57 views

Using ajax to make pages seem more responsive as an alternative to Angular?

AngularJS, Ember and React are all the rage these days. I get their appeal and as much as I'd like to learn them I just don't have the time. I'm writing an unsophisticated application that can be ...
0
votes
1answer
73 views

Understanding streams

I have started learning streaming APIs and I found one of the good documentations here. There was a comparison given by author to demonstrate the effectiveness of the streams. var http = require('...
1
vote
1answer
113 views

Monads in JavaScript

A monad is an object that has: A transformation that takes a type and produces a new type. In C# we call such a transformation a "generic type". We have a generic type M<T>, we have a ...
0
votes
1answer
31 views

Why can't an ES2015 WeakMap have primitive keys?

There are six primitive data types in JavaScript: Boolean, Number, String, Symbol, undefined, null A WeakMap can't have primitive data types as keys. And a WeakSet can't have primitive values. Why ...
-3
votes
0answers
27 views

Unknown javascript function [migrated]

I have the function function bind(method, context) { var args = Array.prototype.slice.call(arguments, 2); return function() { var a = args.concat(Array.prototype.slice.call(arguments,...
1
vote
0answers
70 views

How should I decide switching to vue.js from angular or not as a team member?

Currently I am working on a project that the view depends on data input by user a lot, so AngularJS was used in the project. This was the usual choice of our small team. (so small it is still below 10 ...
5
votes
4answers
567 views

Minimal programmer's definition of a monad

I am trying to formulate a definition of a monad without needing mathematical terms or Haskell to understand. Can a monad be thought of as a function that accepts a value and wraps it such that it ...
0
votes
0answers
21 views

Handling Multiple External Web Beacons on a site

I've been searching for this info but could not quite find an answer that would work for this. I hope it's clear enough... First, let me setup the scene: We currently develop and maintain a mid to ...
2
votes
3answers
173 views

Unit of Work AngularJS

I am writing an application in Angular JS (1.5), and I need to be able to track a model for changes (updates/deletes/additions). For example, I have an ng-model that holds an array of user pets. This ...
0
votes
1answer
21 views

Content refresh interval

I have created a user-support system for my company's website, to enable users to contact the company's staff when they need help. As of recently, the new messages were loaded every time the page was ...
-1
votes
2answers
153 views

One Word for Functions, Variables, and Objects

Is there a single word that can describe JavaScript functions, variables, and objects? I was thinking "entities", but that word is usually used to describe the mapping between objects and a database. ...
0
votes
0answers
47 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
20 views

Project directory structure (javascript)

Over my years of practice and through most of the reading I've done, the oft recommended directory structure for a web app project has been closely tied to the MVC structure: tests/ src/ styles/ ...
-3
votes
1answer
107 views

How do I remove all instances of a key from a JavaScript Object? [closed]

I've got a Java Script object like this: let obj = { selected; true, level1: { level2: { selected: true } } level1: { selected: true, ...
5
votes
1answer
125 views

Alternative for eval() in javascript for expression evaluation

I'm looking at the alternative that can substitute the use of eval() and new Function() javascript techniques. I'm developing a solution build with javascript and the platform on which it is built (...
0
votes
0answers
38 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 (...
-2
votes
0answers
26 views

How to track unread messages for a user in a multi-channel chat application

I'm building an multi room chat application similar to gitter/slack as a side-project. The database schema i have so far is: user table (userid,username) chatRoom table (roomname etc) user-chatroom (...
-3
votes
1answer
146 views

Why does an expression for a Javascript function that returns void still execute? [closed]

I'm so confused about how Void operator (in javascript) works and what is it's role. as i read, Void is an operator that evaluate an expression without returning a value, but by executing that script ...
1
vote
0answers
37 views

Find longest match from a set of possibles, given a string

I’m implementing glossary/dictionary in Javascript. It is populated with a set of terms and their definitions internally, then gets handed jQuery elements and searches the HTML, replacing any of the ...
-3
votes
0answers
81 views

Javascript: Comparing two identical object literals [migrated]

I'm pretty sure I figured this out before, but can't remember why this resolves to false. Can someone explain why? if ({foo: 'bar'} === {foo: 'bar'}) { console.log("Strictly Equal"); } else { ...
2
votes
1answer
153 views

Structuring a Game with Angular.JS [closed]

For a GameJam I'm trying to code a simple web-based text adventure game with sprites and small animations in AngularJS. I'm a little new to Angular and am having some trouble figuring out how to ...
0
votes
1answer
170 views

Business logic - Server side vs client side [duplicate]

In my current project, I have a screen which pulls data from several webservices, pulls data from database via backend API and checks that all resources have the same data or not. The other ...
-2
votes
0answers
23 views

Redis connection failing [migrated]

So I have node app docker containers running, and they run fine, but I noticed over the course of 1-2 months all of my apps begun having errors with redis, seems like the connection is not making it / ...
0
votes
1answer
66 views

Manipulating DOM via script or rebuild website - which is better?

Let's assume you want to change what user sees on the website. There are two ways to do that: a) manipulate the DOM via JavaScript, but user has to download whole script, with possibility he may not ...
-2
votes
1answer
165 views

How does jQuery work?

What exactly happens underneath (I know it changes the paragraph tag's HTML when the circular div is clicked) when I run this piece of code? Could you please explain the callback function as well. &...
3
votes
1answer
127 views

Are promises functional

Functional programming is often explained to agree with lazy evaluation. As far as I know lazy evaluation means that a method gets called if the evaluator/browser/etc. thinks that is the next best ...
1
vote
0answers
59 views

Pointers on porting a c++ workflow domain specific language to javascript

I am writing a game in c++ with the v8 javascript engine embedded in it. I have a c++ workflow system I use to tell things how to do specific things. It's nice and I like it, but I need it to work ...
1
vote
2answers
244 views

Put code on client (JS) or server (C#)

In an ASP.NET app, I've got to decide whether to put a complex piece of code on either the client in JS or on the server in C#. I've considered performance (if on server, it would be a small ...
1
vote
0answers
42 views

Concept: Create rotating 3D Card

I have images of the two sides of a postcard, front and back. I'd like to create a little image view tool that creates a 3D postcard using the front/back images and have the user be able to rotate the ...
0
votes
1answer
211 views

Recently moved from java to javascript on nodejs, how to maintain code? Help!

I recently moved from java to javascript on nodejs. I was very excited, opened up my intellji IDE for an existing nodejs project only to find I cannot know what the parameters I see functions ...
0
votes
0answers
24 views

Do you inject everything explicitly used in a module even if it is loaded in a “parent” module?

When you build a app modularized what do you inject into submodules? Only those things that are used there but not added at the top level, or do you inject everything that is explicitly used in that ...
0
votes
0answers
54 views

Converting dynamic webpage into static

I am working on a project in which I need to take a dynamic website like adobe spark - https://spark.adobe.com/gallery/gallery-editors-choice/example/maggie-to-monte/ and create a static html+css page ...
0
votes
0answers
35 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
45 views

What is the better way to call the bind function in this case?

I am using es6 and babel. I have a class which serves as a in-memory data cache (DataStore). It has an API function called findByIndex. I can retrieve data by using an index name and related ...