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)

27
votes
7answers
3k views

Referencing external javascript vs. hosting my own copy

Say I have a web app that uses jQuery. Is it better practice to host the necessary javascript files on my own servers along with my website files, or to reference them on jQuery's CDN (example: ...
4
votes
1answer
1k views

How should I structure modules in an Angular.js application?

I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS ...
2
votes
1answer
129 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 ...
1
vote
1answer
39 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, ...
-3
votes
0answers
14 views

TreeView Selection [on hold]

I am using a Server Side TreeView Control. I want to get the values after the selection of the items present in the treeview. Actually I can't able to differentiate between the selected items that ...
0
votes
0answers
39 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 ...
-3
votes
0answers
18 views

Collision detection in JS html5 canvas [on hold]

i'm trying to develop a game using HTML5 canvas with javascript and I am having problems detecting collisions without hard coding it using the (x,y) coordinates of the two objects. In my code based ...
2
votes
1answer
403 views

How many Angular Controllers and/or Directives is too many?

I'm building a large, editable data table with angular, and I'm trying to figure out what the best practice is. The table will be a couple of hundred rows, with a couple of dozen columns, so upwards ...
1
vote
1answer
36 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
99 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
0answers
64 views

Were Java and Flash necessary pre-cursors to JavaScript and HTML5? [on hold]

Java appeared in the Netscape browser in 1995, with Javascript and Flash very soon after (I think). Java and Flash allowed programmers to add rich interactions to otherwise static sites, which can now ...
184
votes
3answers
61k views

Pros and Cons of Facebook's React vs. Web Components (Polymer)

What are the main benefits of Facebook's React over the upcoming Web Components spec and vice versa (or perhaps a more apples-to-apples comparison would be to Google's Polymer library)? According to ...
-1
votes
0answers
60 views

Is there a language or platform for running objects in a database [on hold]

I've been experimenting with MongoDB. I like the way it works--documents represented by JSON objects. Now I'm looking for something different--I'd like to store active, running, JavaScript objects in ...
0
votes
1answer
137 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', ...
1
vote
1answer
270 views

Methods for structuring JavaScript SDKs

I've built a REST API and have been using Backbone models throughout a couple different applications to communicate to it. I would really like to build a single JS SDK that can be used in any ...
-4
votes
0answers
53 views

How can we implement string array in node [closed]

How can we define String array in node.js and check if perticular string is available in array or not for example i want to make array of fonts: in config.js module.exports = {development:{ ...
2
votes
1answer
62 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 ...
-4
votes
0answers
46 views

Static typing and no-nil alternatives to JavaScript [closed]

What are some languages, which compile to JavaScript, that are both statically typed and has no concept of nil (via the use of option types)? The goal is to minimize runtime errors. I know there is ...
-1
votes
0answers
24 views

How to tie a POS API to a front-end application using input and selection boxes [closed]

I'm creating a website for a local deli and they use a Clover POS system, I never used REST API for anything yet, i'm fairly new to web developing although I wanted to add the ability for users to ...
2
votes
4answers
2k views

Can I test effectively javascript functions with a PHP unit-testing framework?

If I want to unit-test some of my javascript functions, would it be more efficient (and doable) to use the already installed PHP unit-testing framework, or should I use a javascript unit-testing ...
-4
votes
4answers
2k views

How to not let anyone inspect elements of a webpage?

I was thinking to make some jQuery functions that will use ajax to control mysql. The whole idea is to make separate files of PHP (e.g query.php, addRow.php, update.php and delete.php) provide data to ...
-6
votes
0answers
80 views

I am new to programming,recommend books and topics to cover to become a better programmer [closed]

I am 18 and started coding now which I really feel is late,coming to the topic.I just quit my college I am interested in creating bots,forums and website building and even building Android and I phone ...
-2
votes
0answers
22 views

What factors influence the choice to use Actionscript or Javascript in Adobe Air apps? [closed]

From what I understand, I can choose either: Flash/ActionScript or HTML/JavaScript I used to know ActionScript for games, and I want to learn Javascript for my websites, so I can add some ...
1
vote
2answers
197 views

Live search/filter as you type in client approach

As an exercise for myself to practice my JavaScript "skills" I'm trying to write a client-side filter. It should be able to filter "content blocks" as the user types. By "content block", I mean a ...
28
votes
11answers
3k views

Why the recent shift to removing/omitting semicolons from Javascript?

It seems to be fashionable recently to omit semicolons from Javascript. There was a blog post a few years ago emphasising that in Javascript, semicolons are optional and the gist of the post seemed to ...
1
vote
1answer
2k views

Visual Studio build everytime JS and CSS changes?

I am relatively new to Visual Studio Development and I was wondering - it seems that everytime I make changes to my JS or CSS in my project - I have to "build" the project again. Is there any way to ...
-2
votes
1answer
99 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?
1
vote
1answer
108 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 ...
1
vote
1answer
2k views

Looking to create a custom, graphical editor for a data model using HTML5 and SVG

I need to create a graphical editor for our data model that works in an HTML5 compliant browser. I am looking for a proper library/framework to build on. The model is stored as xml, but that should be ...
0
votes
1answer
73 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 ...
6
votes
1answer
220 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 ...
2
votes
1answer
367 views

Local Updates in Persistent/Immutable Data Structures

I'm getting into ReactJS and am intrigued but also confused about persistent data structures. I love the idea, but I'm not sure how to take my MV*, Mutable, Observable Bindings experience in designing ...
0
votes
1answer
57 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
143 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() ...
0
votes
1answer
71 views

Measure and locate areas of similar value in an image

I saw this picture online and wanted to see if I could create an algorithm to give ordinary images an effect like this: http://justinlivi.net/wp-content/uploads/2011/01/Living_In_Digital.jpg My idea ...
14
votes
6answers
3k views

How risky is it to use Coffeescript without knowing Javascript? [closed]

I'm a reasonably experienced programmer trying to learn web developement. I'm trying to develop a client-side web application which uses svg or canvas for graphics. I've decided I'd like to write ...
5
votes
1answer
848 views

How should I handle a redirect to an identity provider during a web api data request

Scenario I have a single-page web app consisting purely of html, css, and javascript. After initial load and during use, it updates various views with data from one or more RESTful apis via ajax ...
7
votes
1answer
323 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 ...
20
votes
2answers
1k 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 ...
27
votes
6answers
4k views

Dynamic Code Evaluation in Java - Clever or Sloppy?

I am trying to create a flexible ACL framework in Java for my application. Many ACL frameworks are built on a whitelist of rules, where a rule is in the form of owner:action:resource. For example, ...
-2
votes
0answers
57 views

is it okay to add functions to function objects in JavaScript? [duplicate]

I'm wondering if adding functions to function objects is acceptable/okay in JavaScript? For example: var f = function() { //do something } f.anotherFunc = function() { //do something else } ...
0
votes
3answers
275 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 ...
0
votes
1answer
193 views

Creating a voting platform for submissions during timeperiod

I have a site where stories are submitted at any time by users. The staff would like the ability to create a voting period at any time. For example, they can choose to open up voting from today until ...
1
vote
1answer
86 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
169 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 ...
3
votes
6answers
3k views

Is it possible to half-way synchronize javascript functions that include async calls?

I am wondering if there exists a way to half way synchronize javascript functions, where data is requested on the fly. I don't want to make it purely blocking (which I guess is impossible), I just ...
-3
votes
0answers
18 views

Get touch events at 1 second intervals on javascript [migrated]

I am building a touch responsive website using some javascript. I need to get the x-coordinate of a finger touch as it slides across the screen. I have tried the touchmove event, but it polls way ...
1
vote
1answer
142 views

Best use of the React frontend framework

I've been using rails' erb template for my views, but I've recently been trying to incorporate React as my front end framework. I'm a little lost on how front end frameworks are supposed to be used. ...
0
votes
1answer
69 views

Ideal export in terms of size for asynchronous module definitions in JavaScript?

When creating AMD modules you can export whatever you like whether it be an object or a function. I vaguely recall reading a recommendation somewhere to export just one thing; the idea being "keep it ...