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

Best use of 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
87 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 ...
-1
votes
0answers
81 views

Error: Code too big for 64k [on hold]

Im having a bit of an issue with a simple program I'm trying to build. Im using an IDE to code a program I wish to turn into an app in a few months. After 7500 lines of code I receive and error ...
-3
votes
0answers
30 views

Javacript File Inclusion Not working [on hold]

I have followed this thread: What is the best way to include JavaScript file using script tag? and used the following code in my php file. <script language="javascript" type="text/javascript" ...
-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 ...
-6
votes
0answers
30 views

Get info to your site from another site [on hold]

can anyone help me to find a way to get UserKey from TrueCaller ! And.. How can i build a code in C#,to get informations from another site An exampel.. i need to get info about a certain phonenumber ...
-2
votes
0answers
27 views

How to code a Data Scrapper [on hold]

I’m a javaScript beginner. For a practice project, I want to create a Page Scraper that will list of all classical musicians, (say from classicalmusic.com), and then have that data returned in a ...
26
votes
4answers
3k 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
381 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 ...
-3
votes
0answers
37 views

Begining the programming Process, Solving the problem [closed]

I'm now learning JavaScript on Lynda.com and want to develop a practice project. What are the best resources for learning to write JavaScript instructions, plus conceptualizing and defining goals for ...
1
vote
1answer
79 views

Checking for valid state inside function or outside [on hold]

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
130 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
0answers
23 views

SyntaxError: Unexpected token case [closed]

I am having trouble finding my Syntax error in this code. It says it has to do with the case, but I can not see what I did wrong. Sorry I couldn't narrow the code down, I tried and it just gives me ...
2
votes
2answers
57 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 ...
-3
votes
0answers
20 views

How to update more tables using ajax post with dynamic accept friends buttons? [closed]

i have a php file to accepting friends request. <?php session_start(); include 'db.php'; error_reporting(0); $username= $_SESSION['username']; $i=1; $sql = "SELECT * FROM friends WHERE ...
-4
votes
0answers
39 views

How can I create a program which records how much internet data is used by each website visited? [closed]

I don't believe this is even possible but it's worth asking, I would like to create a batch file that when run, it will record all IP addresses or URL's visited during an internet session. It won't ...
0
votes
0answers
58 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
0answers
63 views

Plugins with code that runs only once [closed]

I don't know exactly how to ask or define this question so it may be a duplicate but I haven't found anything yet. I'm working on a project in Javascript (browser extension) that requires plugins, ...
0
votes
1answer
109 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
101 views

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

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
53 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 ...
1
vote
0answers
25 views

jasmine: scope of this [migrated]

From the jasmine documentation (http://jasmine.github.io/2.0/introduction.html): The this keyword Another way to share variables between a beforeEach, it, and afterEach is through the this ...
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 ...
0
votes
0answers
12 views

How to set the cursor position in nsIEditor/nsIPlaintextEditor via javascript in a Thunderbird extension? [migrated]

I'm trying to create a simple Thunderbird extension which operates on plain/text messages when replying to a message. After applying modifications to current editor's content I need to place the ...
7
votes
5answers
584 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
51 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
88 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
94 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
194 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
161 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) { ...
0
votes
0answers
6 views

AppleScript File Deletion Question [migrated]

Brief description of problem: iTunes Match decided to re-download all of my songs into its automatically organized file system in the Music subfolder of iTunes on my Mac. So the folder for a song ...
-4
votes
1answer
137 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
94 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
136 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
186 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 ...
-1
votes
0answers
7 views

Using GreaseMonkey to change Javascript variable [migrated]

I've got a question regarding a website that I use quite frequently. The website is essentially a browser-based air traffic control simulator. The page uses a php script to load the JavaScript ...
5
votes
1answer
126 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
181 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
83 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
124 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 ...
1
vote
1answer
81 views

Assigning default values from environment variable in Node.js

When attempting to set default values for parameters that may exist in environment variables in JavaScript, I often see this pattern: var lag; try { lag = process.env.THROTTLE_LAG; } catch ( e ) ...
1
vote
0answers
51 views

Preserving Pre-formatted Multi-Line Strings in Node.js Scripts

There is a lot I don't like about PHP, but one thing I love is multi-line strings: $query = <<<EOT select field1 ,field2 ,field3 from tableName where field1 = 123 EOT; ...
13
votes
2answers
345 views

Is there any reason to use the “var” keyword in ES6?

Babel's guide to ES6 says: let is the new var. Apparently the only difference is that var gets scoped to the current function, while let gets scoped to the current block. There are some good ...
2
votes
1answer
78 views

How to deal with server-side and client-side naming conventions that clash? [closed]

I have a project that uses the underscore naming convention for the MySQL database and PHP scripts but uses camelCase for the javascript application (a common scenario I'm sure). However, once JSON ...
3
votes
3answers
190 views

With only backend development experience, how do I go into frontend development (js, html, css)? [closed]

Currently I am interning at a company as a "full stack" developer (Application developer on the job title) and I realize that I am having difficulties coping with frontend tasks. This is especially ...
0
votes
1answer
132 views

Better pattern than large if/else if/else for checking conditionals [duplicate]

I've got a fairly large set of booleans I'm checking in javascript, and then using them to alter the state of a layout in my React app. The whole thing is unwieldy, difficult to read, inelegant, and ...
3
votes
1answer
228 views

What is the most efficient / fastest way to keep a list in order?

I implemented Dijkstra's path finding algorithm in JavaScript and a big part of it involves storing the distances to nodes and fetching the smallest. The distances change often and the smallest is ...
2
votes
1answer
55 views

How Javascript Engines access/lookup property names?

How Javascript Engines access/lookup property names? what kind of associative array (data structure or search/lookup algorithm) did they use? (for V8, TraceMonkey, JSC, and Rhino) For example, in C++ ...