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)

-1
votes
0answers
21 views

Building an EXT 4 tree with JSON data [migrated]

I'm building an android app that posts collected battery data to a website viewable by the app user and I'm having issues building a tree to view the collected data. I'm looking to build a tree ...
1
vote
3answers
90 views

Auto-save user input - the smartest way?

I'm developing a social network website and I'm working with php/mysql/jquery and I want users to have the most user-friendly website experience. That's why I try to avoid a save (submit) button at ...
0
votes
1answer
53 views

Javascript Constants in ES6

What would be the preferred way to create constants in javascript, specifically with ES6? Currently I have a constants class which has methods that return the string I'm looking for. class ...
-5
votes
0answers
88 views

Would it be put me in risk if I use open source software? [on hold]

I have came across the web and found that GWT online toolkit which enables to use JS, XML, JSON integrity with java applications. But this seems to be an open source. In my workplace, it should not be ...
1
vote
1answer
174 views

Why can a constructor be used without `new` keyword in Javascript?

I found Date can be used without the new keyword. Date(1) > "Thu May 28 2015 15:54:20 GMT+0800 (CST)" new Date(1) > Thu Jan 01 1970 08:00:00 GMT+0800 (CST) I was wondering whether there is ...
-5
votes
0answers
37 views

Ambiguity with instanceof in Javascript [on hold]

My question is about the following code: var name=new String("NewDelhi"); var count=new Number(10); console.log(name instanceof String); //false console.log(count instanceof Number); //true When I ...
-4
votes
0answers
10 views

How to add custom view to markers located on a map?

I have been working around with a store locator application built using JavaScript. I am able to locate the stores on the map but how to add a custom view to the markers of the stores so that when an ...
1
vote
2answers
85 views

In javascript, should object properties be declared on top of the function?

I learned that it's good practice to declare variables before they are used. For example: function myFunction() { var i; var j; } Does the same thing go for object properties, and is there a ...
1
vote
1answer
71 views

html/css/javascript for game ui's

I've been looking into game ui's recently. My conclusion is that html/css/javascript would be the perfect solution IF it was wrapped up in a nice C++ library that allowed for easy integration into ...
-4
votes
1answer
86 views

Should I remove logging statements on production? [closed]

I have a bunch of console.log statements in my AngularJS app. Should those be removed for production? Are there potential issues from leaving them on?
-3
votes
0answers
17 views

Mvc manage context and reusable components [closed]

I'm trying to create for a Web App an MVC Architecture with a Hierarchical Router. The goal is manage all the business logic and views with a clear pattern. Let me do some example: Route index ...
-6
votes
0answers
58 views

Drawing shapes with JavaScript [closed]

A javascript program. I don't want or can't use images. I want to represent countries. I'd like to know if there's somewhere a database, with countries shape coodinate, that you could use to draw ...
1
vote
1answer
115 views

Differences in design/thought process for OO in Java and JavaScript [duplicate]

Despite sharing a similar name and syntax, Java and JavaScript are quite different. However, they both have Object Oriented features. As a JavaScript novice, the main differences that I can see ...
-3
votes
2answers
134 views

JavaScript form validation without clicking submit button [closed]

I want to validate a form using java script before user clicks the submit button. <form role="form"> <div class="form-group"> <label for="email">*Email ...
2
votes
1answer
78 views

How to design a serverside heartbeat with nodejs?

I would post this on http://stackoverflow.com/, but figured I am not looking for code, just an idea how to accomplish this. I have a gameserver that interacts with nodejs and uses the websocket ...
-6
votes
1answer
40 views

How do you pass or fail performance tests? [closed]

If you need the tests to be consistent, define some failure criteria and measure. If you need the tests to be at least X fast (where X is ideally some metric gathered by usability testing) then do ...
0
votes
3answers
235 views

What arguments are there to use a coding style for each distinct language? [duplicate]

I recently had a discussion about our coding style for C# projects. Two things in particular were very hard to agree upon. Method Naming C# has the de-facto standard of naming (at least public, ...
0
votes
0answers
30 views

Trouble with a heightmap adjusting algorithm [migrated]

I have a 2D grid of integers. The user can pick any location and increase or decrease its number by one. The algorithm should adjust all eight adjacent locations so there is no more than a difference ...
0
votes
1answer
33 views

Bundling and minifying options for MVC2

I've just been handed an MVC2 application and noticed that there is no bundling or minifying of the JavaScript or Stylesheets. I've used the built in bundling and minifying logic that comes out the ...
0
votes
1answer
51 views

JSP in Javascript file or multiple AJAX requests

I've been thinking about how I want to load my data for some checkboxes in an AngularJS app. I'm generating multiple checkboxes based on 2 JSON objects that are currenty hard-coded in the a Javascript ...
0
votes
2answers
76 views

How to protect controller endpoint from abuse?

I am building a web app that will first validate a promotion code via AJAX call and then if it is valid, allow the user to fill out the rest of the form, I use KnockoutJS to reveal and hide the ...
7
votes
1answer
171 views

Why create a Global-ish Object.create function?

I'm a fairly experienced programmer in the .NET and Java realms, and I've started reading up on JavaScript. I bought Douglas Crockford's "The Good Parts" book, and I'm immediately put off by a few ...
0
votes
1answer
33 views

node deep file indexer module cannot go deep [closed]

I'm trying to make a file indexer by node.js. The program is supposed to index files and folders in an array and also check inside folders and add all sub folders and files I wrote: ...
2
votes
0answers
158 views

Javascript callback design: is it OK to have side effects?

Consider this javascript function: function(){ var someArr = [...]; var someObj = {...}; someArr.forEach(function(item){ if (matchItem(item)){ ...
0
votes
1answer
39 views

Is there any reason not to allow negative numbers to be entered into a JSP field labeled for positive numbers?

Our application, a fairly complicated money ledger, has a JSP field for entering a certain type of money due, balanced by payments made towards that amount due. In the application, this field is ...
2
votes
2answers
185 views

Pre-Processors vs Pure Web [closed]

It seems like within the last few years or so HTML/CSS/JavaScript Preprocessors have exploded in quantity and general use. They're still not as common as pure HTML, CSS, and JS/jQuery, but their ...
0
votes
1answer
135 views

Why sending a file is so difficult using angular? [closed]

I have to send a file (very large file) to a server. I'm studying what options I have and how to do it. I'm using angular + express + nodejs. If I use a simple form, I could catch the file on the ...
0
votes
0answers
116 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 ...
2
votes
1answer
50 views

Reuse already fetched data for request

I have action that fetches user model from db to check access. Then I have method that in some cases requires same model. function checkAccess(req, res, next) { var data = ...
4
votes
1answer
93 views

Nested classes via a getter (to emulate namespacing)

So, we all know that ES6's introduced syntax is definitely sugar over what we've been doing, previously. That being said, we still don't have namespaces (which would be nice...) The problem that I'm ...
1
vote
1answer
249 views

Why is it common to put an underscore before a method in JavaScript? [closed]

For example, I noticed that in the jQuery UI widget factory, methods like _init, _start, _on, ect.
3
votes
1answer
179 views

Is there any reason not to make a webapp be client-side only?

I recently started writing a path-finding algorithm simulation application in python. It takes user inputs, randomly generates a 2d graph, and shows displays the simulation via GUI. Now, what I ...
0
votes
0answers
64 views

“Python interpreter vs Javascript engine” memory model

I learnt that memory model of python interpreter is dictionaries of dictionaries, where each module is a dictionary. Let me elaborate more on this with an example, After i run >>> python ...
1
vote
1answer
74 views

React and simple UI state

I'm starting to playing around with React and have a basic question regarding state. I understand that in React state should only contain data which may change and cannot be computed from elsewhere, ...
1
vote
1answer
129 views

How do I design a Javascript Object to not use any public properties?

I have been playing with the Object creation outlined by Douglas Crockford in his new talk "The Better Parts" function constructor(spec){ var that = otherConstructor(spec), member, ...
1
vote
1answer
63 views

Keeping client side model and server side in sync in SPAs

Since SPAs have most of their domain logic client side, how do you keep your domain model in sync with the back end? For example, let's say I have a .NET WebAPI web service that uses the Entity ...
0
votes
1answer
149 views

How do I make a JavaScript promise return something other than a promise?

I have a spec from a client for an implementation of a method in a module: // getGenres(): // Returns a promise. When it resolves, it returns an array. If given an array of genres, ['comedy', ...
2
votes
1answer
73 views

In what case would indexedDB be useful [duplicate]

I have been over-viewing indexedDB recently, and I cannot seem to find a suitable use case that would not be better done using a server side database. Since the little hackathon competition I'm doing ...
-2
votes
1answer
112 views

How deeply can a JSON object be nested?

I was watching a video on a website that said json objects can be nested deeply. How far can a JSON object be nested before it will create an error?
0
votes
1answer
78 views

Trying to learn about core concepts in Javascript by making a web app, how can I do that without jumping to MVC frameworks? [closed]

For some reason I don't want to jump to a javascript MVC framework to make a web app for my portfolio. My main motive behind that is to learn in & outs of Javascript. What are my options if I want ...
1
vote
1answer
159 views

Correct usage of Bluebird promise

This is related to this question on promise performance. The current top answer states that using new Promise is an anti-pattern in bluebird And that promisify should be used instead. I ...
0
votes
1answer
74 views

Javascript inline event handling versus external jQuery event handlers

Working on a dynamic website that loads information from a JSON file and then populates the page with said elements. My question has to do with event handling - as of now, I don't see any reason as ...
0
votes
2answers
155 views

Is it OK to use Promises for Caching

Is it an acceptable (not surprising) to use promises to cache results? The idea is to generate a promise once, and just return that same promise again on subsequent calls. For example, a getAll() ...
9
votes
1answer
470 views

Why are native ES6 promises slower and more memory-intensive than bluebird?

In this benchmark, the suite takes 4 times longer to complete with ES6 promises compared to Bluebird promises, and uses 3.6 times as much memory. How can a JavaScript library be so much faster and ...
21
votes
2answers
2k views

How much should I be using 'let' vs 'const' in ES6?

I've been writing a lot of ES6 code for io.js recently. There isn't much code in the wild to learn from, so I feel like I'm defining my own conventions as I go. My question is about when to use const ...
7
votes
1answer
334 views

Language compiled to JS – most elegant way to do synchronous-style waits

I'm trying to make (yet another) language that compiles to JavaScript. One of the features I'd like to have is the ability to perform JavaScript's async operations synchronously (not exactly ...
0
votes
3answers
283 views

Is JavaScript fail-safe?

I was compiling a list of comparison of top 10 programming languages (JavaScript included). I was doing it from this Wikipedia page. However, in the third table (Failsafe I/O), there is no row for ...
1
vote
1answer
90 views

Multiple CS Sheets or Javascript

I have a homepage with a navigationBar on top of the Viewport contains two buttons. One is the default selected home button which calls/displays home.html. The other for example is Ubuntu which calls ...
0
votes
0answers
36 views

best/preferred way to create a “plugin” in JavaScript: “OOO” or array of each instance [duplicate]

I'm working on creating a "plugin" in JavaScript. I can't think of how to simplify my plugin's purpose so for the sake of simplicity let's say it is a table filter plugin. Either way the user would ...
1
vote
3answers
176 views

Avoid opt(options) in javascript [closed]

A lot of frameworks, most like jQuery plugins uses the "optional" parameter. Basically a dictionary (or key/value structure) with a bunch of additional parameters instead of send in the parameter's ...