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)

0
votes
0answers
10 views

Annotating pdf files in chrome browser

I am trying to develop a chrome extension that can help users annotate pages and pdf files opened in the chrome browser. I have successfully enabled it for web pages using annotator.js but still not ...
0
votes
1answer
23 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
0answers
26 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 ...
-3
votes
0answers
69 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
231 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
170 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
47 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
47 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
0answers
68 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 ...
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
1answer
45 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
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', ...
2
votes
1answer
64 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
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?
0
votes
1answer
76 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
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 ...
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() ...
7
votes
1answer
248 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 ...
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 ...
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 ...
-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 ...
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
173 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 ...
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
185 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 ...
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, ...
1
vote
5answers
406 views

why are globals bad in javascript [duplicate]

I've been writing web applications for a while now , and everyone knows the one golden rule not to assign variables to the window object , don't ever assign a variable without using var. My ...
1
vote
1answer
88 views

Checking for valid state inside function or outside [closed]

This is a common occurrence in programming and is language agnostic, you have a function that needs to do something but in only in some cases. Maybe it's a feature-toggle, maybe it's a function that ...
2
votes
1answer
137 views

Are web sockets a browser feature or supplied by a specific OS version?

Are web sockets a web browser feature, developed and evolving as the browser developers want, or this feature dependent on the OS version? For example, can I use this feature in JavaScript in IE and ...
2
votes
2answers
75 views

How hidden classes allows faster access to properties in google's V8?

As Lars Bak and Jay Conrod described in several videos and papers, the main idea of hidden classes in V8 is to store concrete offset or transition to another hidden class which probably contains this ...
0
votes
0answers
91 views

Choosing a javascript framework for a massively multi-player game : React vs Ember 2 vs other better option

I'd like to add to my Ruby on Rails app a javascript front end using basically Rails a json api sending data to the front end. The question for me is: React or Ember 2 (or maybe another viable ...
0
votes
1answer
117 views

Do you also find the use of functional reactive programming in JavaScript a bit overbloated? [closed]

I've been reading this article: http://modernweb.com/2013/09/30/functional-reactive-programming-in-javascript/ and I found the examples there way too complicated for what the code is supposed to do. I ...
0
votes
1answer
171 views

How to create a JSON or HTML file that dynamically mirrors file directory structure for jsTree 3.0 [closed]

I am looking to create a JSON OR HTML file that will accurately give the folder/file structure for a directory for use with jsTree 3.0 (www.jstree.com). I want to make it AJAX/lazy load so that each ...
0
votes
1answer
60 views

Personal Digital Signatures in Web Applications [closed]

In order to sign data with personal digital signature in a web application, server side languages like PHP can do the whole job, but that would require that the user uploads his private key, lets say ...
14
votes
3answers
2k views

why is the latter function 10% faster although it must create the variables over and over again?

var toSizeString = (function() { var KB = 1024.0, MB = 1024 * KB, GB = 1024 * MB; return function(size) { var gbSize = size / GB, gbMod = size % GB, mbSize = gbMod ...
7
votes
5answers
617 views

Why JavaScript? What's the advantages? [closed]

This is not a simple question, but I was thinking, what advantages are really there in the JavaScript language? We all use JavaScript on the browser, of course, there is no other choice (you can use ...
-1
votes
1answer
55 views

keeping of all javascript functions in one place [duplicate]

In php website I am using different javascript functions in different pages for example page a calls functions 1,2,3 and page b calls functions 2, 4, 6 and page c calls functions 3, 6 can I place ...
1
vote
1answer
106 views

Calculating winning probability for 2 teams using their history?

So I'm working on this project where I have a database full of team winning history. For example let's say these are all football teams. Every match has 2 participants (2 teams) and always a winner. ...
0
votes
1answer
118 views

Does streaming video pass through the website's server when embedded with javascript from another site?

Not sure how else to phrase this question, so my apologies if it's been asked before. We use Brightcove for streaming video. They offer an option to embed one of their players on your webpage using ...
0
votes
2answers
200 views

Is there any plan to take out “features” from next versions of javascript? [closed]

I'm looking to learn javascript (now for real) and I've had a look on the latest version of ES6 which is supposed to be frozen in terms of features set. It seems to be the pretty much same as ES5 ...
3
votes
2answers
171 views

Would there be any benefit to writing synchronous code using the syntax of promises

Is there such a concept as a synchronous promise? Would there be any benefit to writing synchronous code using the syntax of promises? try { foo(); bar(a, b); bam(); } catch(e) { ...
-4
votes
1answer
190 views

Why doesn't v8 compile typescript instead of javascript? [closed]

Since Typescript is just a superset of javascript (every javascript program is also a typescript program), I've got this idea - why doesn't v8 support typescript? or anything statically typed ...
2
votes
1answer
97 views

Need an algorithm to filter this collection format

I'm sorry the title is so vague ... I cannot think how to describe it any better. I have a collection in this format: var myCollection = [{id:"a"}, {id:"b",excludes:["a"]}, {id:"c",excludes:["b"]}]; ...
0
votes
0answers
54 views

Extension of native prototypes, good or bad practice? [duplicate]

Today I stumbled upon this page on the Mozilla Developer Network. In it, not only it is stated that it's a bad practice to extend native prototypes, but also that there is only one exception to this, ...
0
votes
1answer
154 views

Best Data structure for implementation of dependent drop-downs

I want to implement dependent drop-down feature on a web page in my website containing the following drop-downs: User's group name Group events (dependent drop-down) Locations (dependent drop-down) ...
1
vote
1answer
195 views

How to merge two functions that do same things with different variables

I have these two Javascript functions that are equal except for the variables onClickVoteUp: function (e) { var $target = $(e.target); var upvoted = this.model.get("upvoted"); var ...