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
1answer
107 views

JS design pattern/algorithm for avoiding duplicate redraws in a fairly coupled system

Given: some sort of widget based web app lots of JS functionality high coupling (communication/callbacks between widgets) widgets draw themselves certain widgets need to do a complete and fairly ...
0
votes
0answers
207 views

How to add document directory path in javascript file in iOS -MetaIO SDK

I am working on a project using MetaIO SDK (AREL). It works fine with all the files in the package (ipa), but I'm trying to download an animation automatically using a web service. It will be ...
0
votes
2answers
147 views

Old Browsers and Polyfills

Polyfilling, when is it too much? I've summed up this question into one sentance. Is it practical to polyfill all of the IE8 deficiencies with one solid javascript file, as in, would there be any ...
0
votes
1answer
67 views

Ideal & idomatic javascript interface for RESTful API

I am trying to write an angular service to interface with a RESTful API. For sake of simplicity, lets assume the API is + Company |___+ Department | |____ Person | |____ Person Notice how ...
9
votes
4answers
578 views

Should I parse XML on the server or provide a proxy and let the browser parse it?

I need to interface with a 3rd party API. With this API I make a GET request from within the end user's browser and receive an XML response. This data is to be used in a browser based application ...
28
votes
8answers
5k views

Is splitting up a function into several inner functions an anti-pattern? [duplicate]

Imagine a long and complicated process, which is started by calling function foo(). There are several consecutive steps in this process, each of them depending on result of the previous step. The ...
2
votes
4answers
587 views

How to develop cross platform mobile applications with native UI and Javascript backend?

I want to build a cross platform(Android, iOS, Windows) mobile application. I want the UX of the application to be different on the different platforms so that it will be more platform specific and ...
0
votes
1answer
203 views

Best practice for storing information from a php script for future use

My employer uses forms to help people search for products. The product lists can change from time to time and the forms need to be updated again. The product information can be accessed through a ...
2
votes
2answers
142 views

How are some IEEE 754 floats printed succinctly?

Using this calculator, I can see how the decimal ".8" and the expression ".7 + .1" have different representations: .8 = 1.1001100110011001100110011001100110011001100110011010 *2-1 .7 + .1 = ...
0
votes
2answers
162 views

Should the check correctness of a time constrained puzzle game application be done on the server side?

I am working on an application where a user has to complete a puzzle and check within a given time limit. This is an HTML5 based game, I can't keep the solution on the client side. but I also want ...
2
votes
1answer
250 views

JavaScript Compression and Caching of Assets

I'm working on an idea that i can't seem to find a good answer though hours and hours of searching, I'm planning a small Canvas/WebGL Application this application will be using WebSockets to talk to ...
0
votes
2answers
157 views

Alternatives to the use of the Id/Name properties with non-inputs elements in HTML

I'm migrating a website that use Javacsript/HTML/PHP using reusable javascript code, in certain moment I saw the opportunity to simplify code in functions that use almost the same code. Let's say: I ...
0
votes
4answers
2k views

Why do C# developers newline opening brackets? [closed]

I've spent most of the last several years working mainly with C# and SQL. Every programmer I've worked with over that time was in the habit of placing the opening brace of a function or control flow ...
-3
votes
1answer
325 views

Why is the JavaScript-language different in different programs/sites? [closed]

I'm kind of new to programming and i have a question that's been bothering me for awhile. Why is the JavaScript-language different in different programs/sites. I've used Codecademy to practice and ...
0
votes
1answer
130 views

Would it be the right software engineering system to move from AngularJS-based to jQuery-based or hybrid implementation for webapp?

I am presently working on an AngularJS-based chat webapp, and it polls the server for updates, and then renders them in what is pretty much a straight shot in AngularJS. The result looks appropriate ...
3
votes
2answers
227 views

What is the reasoning behind these design choices? [closed]

In ReactJS tutorial you are guided in the building of a commenting system. It's a very useful tutorial to understand ReactJS library, but there are some design choices I can't fully understand. So ...
50
votes
8answers
8k views

Client-side coding: How to prevent malicious use?

Over the last few years, the trend for client-side (browser) applications has really taken off. For my latest project, I have decided to try and move with the times and write a client-side ...
3
votes
1answer
125 views

A question about static types

How would you statically type the following JavaScript program function c(str) { c = eval(str); return c(str); } I'm not trying to start a flame war but I'm genuinely curious. I've always ...
0
votes
1answer
162 views

How to tell node.js which javascript code runs on server vs client?

I am trying to learn the theory of node.js but can't seem to figure out how node.js knows whether to pre process it on the server or send it to browser for execution.
3
votes
5answers
2k views

Pure Front end JavaScript with Web API versus MVC views with ajax

This was more a discussion for what peoples thoughts are these days on how to split a web application. I am used to creating an MVC application with all its views and controllers. I would normally ...
2
votes
3answers
274 views

Will object reuse optimize this often-called function?

Suppose I have a function that I need to call a lot, maybe a few thousand times on every mouse down or mouse move. It uses an instance of a function (class), called Transform: function func1(a, b, c) ...
4
votes
4answers
375 views

How to write JavaScript while keeping HTML/CSS out of it

What is / are some recommended ways to write JavaScript as to control behavior of showing HTML on screen, while keeping well-maintainable code? Basically, I started to look for ways to keep HTML/CSS ...
2
votes
3answers
357 views

How can I refactor client side functionality to create a product line-like generic design?

Assume the following situation similar to that of Stack Overflow: I have a system with a front-end that can perform various manipulations on the data (by sending messages to REST back-end): Posting ...
26
votes
6answers
2k views

Tight Coupling Between Javascript, HTML, and CSS: A More Modern Approach?

It's very common to see Javascript bound to certain selectors to find elements, store data, and listen for events. It's also common to see these same selectors used for styling. jQuery (and its ...
2
votes
2answers
885 views

What is the recommended approach for helper functions in JavaScript?

What is the recommended approach for helper functions? I would like to choose one technique, and run with it to create my new "class". Here are the design options I have pondered: Option 1: Helper ...
1
vote
0answers
142 views

Reducing code complexity for an interface between angular and d3

I'm playing around with different ways of integrating d3 and angular, in the context of learning both of these frameworks, and am hoping for some input: My client application receives a JSON array ...
8
votes
2answers
516 views

Javascript MVC application design (canvas)

I'm having difficulty grasping how to structure/architect a canvas application using an MVC like approach in Javascript. UI will be fairly fluid and animated, the games fairly simplistic but with ...
1
vote
1answer
140 views

Object Chain through an Interface

Say I have 3+ types of objects: function Sea() { var logs = [Logs]; this.getLog = function(ind){return logs[ind]} } function Log() { var bumps = [Bumps]; this.getBump = ...
3
votes
0answers
145 views

JavaScript Combination Inheritance Pattern

In the chapter of Professional JavaScript for Web Developers on OOP, Nicholas Zachas describes a JavaScript inheritance pattern which he refers to as combination inheritance. The basic idea is that ...
0
votes
0answers
62 views

Token based autorization for a web game

I am lead developer for a multiplayer game in a small startup company. I would like to present here my solution for token based authentication and hear your opinions about possible weak spots. I am ...
7
votes
3answers
1k views

Are there open-source JavaScript libraries addressing multiple browser tabs and client state for newer browsers?

There are a few new HTML5 features that have made it into recent browsers that allow sharing state among tabs, browser windows, same domain windows, etc. So it's probably gotten a little easier to ...
8
votes
1answer
1k views

I know JavaScript really well, but i bomb coding interviews [closed]

So I'm currently on a hunt for a new position as a Front-End Developer. I know JavaScript very well and can wax poetically about Closures, Currying, Prototypal Inheritance, Design Patterns, App ...
1
vote
6answers
681 views

I need a JavaScript runtime environment [closed]

I'm reading books on JavaScript programming, and I need an environment like Python's IDLE to type JavaScript commands into and then see the results like you would in IDLE. Is there an environment ...
0
votes
1answer
144 views

Difference between lexical scoping and passing variables in JS

There are several ways to reach the same end point in JS, for example: (function (foo, bar) { return {run: function () {return foo(bar);}}; } (foo, bar)); (function (foo, bar) { return ...
2
votes
1answer
189 views

Sub routing in a SPA site

I have a SPA site that I'm working on, I have a requirement that you can have subroutes for a page view model. Im currently using this 'pattern' for the site MyApp.FooViewModel = MyApp.define({ ...
-1
votes
2answers
258 views

Whats the best way to build a HTML/AJAX site that requires login? [closed]

Let's say that hypothetically you wanted to build a website that delivered content to the visitors entirely using HTML and Javascript (AJAX to fetch server side data). The site would require login for ...
0
votes
0answers
27 views

What's the Content-Security-Policy-friendly way to hand data from the server to the browser on page load?

When developing for the web, I often find myself wanting to pass a few variables from the server scripts to my javascript - data pulled from a database, and set differently on different pages running ...
1
vote
2answers
255 views

Why a hashtable? Why not just a non-hashed associative array?

I've been learning about using a hashtable to efficiently check for items in a list without looping through the whole thing, but there's one thing that I don't get: Why hashed keys? It seems like: ...
0
votes
3answers
196 views

How should I include jQuery in a library?

I'm writing a JavaScript graphing library using canvas which I am licensing under MIT, and I'm using jQuery, as well as a couple of other open sourced libraries, all under MIT. I'm also using bower to ...
1
vote
2answers
553 views

Best practices / reasons for String constants in JavaScript [closed]

In static languages like Java/C#, I commonly make use of constants for strings or numbers, rather than insert them into the code alone. However, I tend to avoid this practice in JavaScript. More ...
3
votes
2answers
208 views

Minimizability or readability?

I am authoring a lot of plugins for the content management system that I am writing. I believe it to be of utmost importance that script files (especially if they're plugins) should load quickly, ...
0
votes
1answer
358 views

Javascript function should call python logic in django web development without additional triiger

I have been trying to solve this problem for sometime now. This is regarding django web development. I have an HTML page which has a Javascript function to upload an image file from the users local ...
10
votes
2answers
453 views

Why is the use of constructors discouraged when creating prototypes?

Quick background: In JavaScript, the constructor function for each object type has a prototype property. The prototype refers to an object that each constructed object uses as the next step up in its ...
0
votes
3answers
282 views

Simple straight-line path algorithm [closed]

I need a simple pathfinding algorithmn to go from point A to point B. A* seems like an overkill because It doesn't matter wheather I hit walls or not and there's no terrain. I was wondering if there ...
4
votes
3answers
7k views

What is the need of Odata when I have JSON ?

I am trying to understand the point of Odata and when it would make sense. Right now how I work is I use ASP.NET and MVC/WebApi controller to serialize/deserialize objects into JSON and have ...
27
votes
5answers
7k views

Pros and cons of an HTML/JavaScript only web app

I come from an ASP.NET forms background and have found server side coding very powerful in the past. More recently, however, I have been wanting to phase out the server side code of the front-end and ...
7
votes
1answer
4k views

How do I decide what testing framework to use?

The situation is this. I'm a junior developer for a small government IT project. We don't have anything of continuous integration or a automated testing framework. But the idea is to be developing ...
0
votes
4answers
191 views

HTML - Alternative for ID when ID is only unique within a certain scope?

So I feel like this should be a common question but I can't find the answer. Maybe I'm using the wrong terminology. Assumptions: IDs are supposed to be unique across the document. Class attributes ...
0
votes
1answer
327 views

When does a Monad become a hammer?

I realize my precursory understanding on Monads is severely lacking in detail considering my knowledge comes mostly from Douglas Crockford's Monads and Gonads talk and complicated with my sevear ...
0
votes
0answers
65 views

Binding in web frameworks - to frontend data or backend data?

AngularJS and other web frameworks provide data binding abilities (as in WPF). Is the UI bound to JavaScript variables on the frontend (web browser) or is it bound to the data in the server (via AJAX ...