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
10 views

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

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 ...
-2
votes
0answers
29 views

Ajax onSubmit call a little help [on hold]

So I've made a dropdown list in Razor Code looks like this: @Html.DropDownList("Languages", BetXOnline.Configuration.WebConfiguration.GetLanguages().Select(x => new SelectListItem() { Text = ...
-2
votes
1answer
84 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?
-2
votes
0answers
67 views

Question about future of Angular during a job interview [on hold]

Due to the drastic difference between Angular 1.X and 2.0, should a large company like ours adopt Angular 1.X to build their Web projects? Although Angular 2.0 is far from being released ...
-1
votes
1answer
119 views

How to pay the users of my website according to the number of clicks they get on the ads placed on their page [on hold]

I want to make a website where A user can login and put content on the website and a google or Chitika add will be placed automatically on their content. According to the popularity of the content, ...
-1
votes
0answers
14 views

add an object or edit if exist (indexeddb) [on hold]

I have this code and i can add or edit the object if exists, but the "for" finish before the function onsuccess is called, then the index "for" is bad. How to pass the index onSuccess? Help!!! ...
0
votes
1answer
72 views

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

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
88 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
49 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
136 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() ...
6
votes
1answer
194 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 ...
19
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 ...
-1
votes
0answers
37 views

Change numbers in url - chrome extension [closed]

I am trying to make my own chrome extension but I have only basic knowledge of html and js is gibberish to me. So I am begging for help. I have this kind of url: ...
7
votes
1answer
310 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
1answer
69 views

Patterns for packaging static web applications in a single file / minimal set of files [closed]

We have a situation where we get a designated drop location on a client's server for static content we develop that they in turn use in their application. Think single page application that talks to ...
-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
274 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
81 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
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
132 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
180 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 ...
-2
votes
0answers
67 views

JavaScript prototype chain probable infinite cycle lookup [migrated]

I have a query regarding JavaScript object prototype chains. Suppose I create an Object var first = { a: 1};var second = Object.create(first); Now I know that if I look up for the attribute a on ...
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
401 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
87 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
135 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
62 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
79 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 ...
-2
votes
0answers
15 views

Select one row in an xsl grid using a radio button and storing data to a variable [migrated]

I am using an xsl sheet that has a data grid. I have a radio button at the end of each row. The user is only allowed to select one radio for the entire grid. So if there are 50 rows of data, the ...
0
votes
1answer
112 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
143 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
58 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
612 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
54 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
98 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
105 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
199 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
166 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
162 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
96 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
145 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
191 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 ...
5
votes
1answer
135 views

Is it poor decision making that using promises for GUI inputs?

So as you know the context: DOM with JavaScript, even though I think it is mostly a language agnostic issue (I know I put both language-agnostic and JavaScript tags, but it's only to let you see ...
3
votes
3answers
184 views

Anything wrong with direct evaluation of JSON if your own code created it?

Suppose I have a server-side variable containing JSON (named strJSON) that my own code created. In JavaScript I can consume it like this: var data = <%= strJSON %>; or use a JSON parsing ...
1
vote
2answers
94 views

Observer pattern: Prevent multiple firings on changed internal property

I have an object Foo that has 2 public properties: A and B. These properties can be changed from outside, as the application I'm working on is using a data-binding architecture. This is the ...
2
votes
1answer
127 views

Declaring JS Functions in Two Ways : What's the Benefit?

I've come across JS code in which I see functions being declared in two different styles: Method 1 function doSomething(){ alert('This is one way of declaring a function'); } Method 2 ...