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)

-4
votes
0answers
21 views

Scripting language for Windows to parse XML file into multiple XML files? [on hold]

I need a script to do the following: parse big XML files create a directory structure based on the XMLs splitting the files into multiple files in the created directory structure It will be run ...
4
votes
1answer
90 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 ...
0
votes
1answer
74 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 ...
15
votes
6answers
2k views

Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?

I asked this question on SO but was suggested to try here. So here it goes: My understanding of Javascript so far has been that it is a client-side language that capture events and makes a web-page ...
-3
votes
0answers
68 views

Python - Very hard task - How to get text from site [closed]

I want to get the text repeatedly because the site regenerating text faster in one line of webpage. How to do that? Several days past but I can't do that. This is my part of the code: soup = ...
1
vote
1answer
230 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.
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 ...
3
votes
1answer
169 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
46 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, ...
0
votes
0answers
45 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 ...
2
votes
1answer
408 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
43 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
103 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
67 views

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

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 ...
185
votes
3answers
62k 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 ...
0
votes
1answer
144 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
274 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 ...
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 ...
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 ...
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
103 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
117 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
75 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
244 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
371 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
62 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
147 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
72 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
861 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
325 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
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 ...
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
194 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
171 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 ...
1
vote
1answer
153 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. ...
3
votes
1answer
183 views

How can 'yield' be added as a keyword in ES6 if it wasn't a reserved word?

yield is not a reserved word in JavaScript, yet ES6 makes it a keyword. I thought the point of reserved words was for backwards compatibility. For example, let and const were reserved, so you ...
5
votes
3answers
630 views

How come javascript, being a prototype based language, doesn't have an easy way to access the prototype?

May be this is a stupid question, but I'm kind of intrigued. Being JavaScript a prototype based language, with its pseudo-class function constructors sort of half baked (remember JavaScript: The Good ...
5
votes
0answers
254 views

Is obtrusive JavaScript required to support a feature of AngularJS?

I'll start by saying I'm just learning about AngularJS, and I was reading this article, which seems to advocate for obtrusive JavaScript as the right thing: ...
0
votes
1answer
432 views

Dynamic query in MySQL

I'm doing a J2EE web application with Struts2, MyBatis and a MySQL database, so what I want is to allow the user to be free to choose different parameters to perform a select to a table in the ...