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

Using ajax for rails. Use Capybara or start using Jasmine?

I have a rails that that, like many started out life as all .erb pages. Now I am increasingly writing functions in javascript using jquery to avoid entire page reloads. Sometimes there is js before ...
-1
votes
2answers
176 views

Why can't anyone get “scroll bounce” right in JavaScript? [on hold]

I've never seen a convincing example of 'scroll bounce' in JS. Something about the friction or elasticity looks/feels unrealistic, even in simple demos for popular touch libraries. I'm not looking ...
-2
votes
0answers
30 views

CSV data to Chart.js Graph [on hold]

I have a Bootstrap website to which I am trying to add a Chart.js line chart. I have an example chart working but have not added my data to the script for use in the chart. I have looked over lots of ...
-1
votes
0answers
36 views

Is there a good course in the Netherlands/Belgium where I can learn SPA, RequireJS & KnockoutJS? [on hold]

I have a background as a .NET/C# developer and I need to get more familiar with client side development. For my current activities, I need to become more familiar with Single Page Applications, ...
8
votes
5answers
3k views

When a task can be accomplished by either Javascript or CSS, is it better to use CSS? [on hold]

I always veto JavaScript by using CSS as much as possible. i.e. I create tabs and rollover buttons using CSS rather than JavaScript. I have seen some solutions—specifically the Wt ...
12
votes
7answers
1k views

What constitutes “Proper use” of the javascript Eval feature?

Eval is a notoriously controversial language feature. Douglas Crockford flat out rejects it. I'm wondering what specific risks Eval brings about. According to this question, Improper use of eval ...
0
votes
1answer
158 views

Dynamic query in Mysql

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

From a technical point of view, could JavaScript be compiled instead of interpreted?

The question title speaks for itself. I'm specifically thinking in terms of a Node.js server. Additionally, this question is assuming that you don't need eval(). Also, if this is not possible, why ...
1
vote
1answer
228 views

What is the “best practice” for converting an external API's data structure?

When an API's data structure does not fit well with an angular app, I am trying to determine the best-practice in my specific design and implementation for converting it to a usable structure. I was ...
0
votes
0answers
27 views

Using ng-init to initialize data in Angular controller

Recently I came across the following in one of our projects. In one of our mvc views they are passing model data to an Angular controller through ngInit directive In xxx.cshtml <div ...
2
votes
1answer
308 views

How can I keep Web services requests in a DAO layer without tying the code to the DOM?

I'm working on a single page application on the node-webkit desktop app platform, which means 99.9% of all of the logic is written in JavaScript. Since this is a reboot of a project we're working on, ...
0
votes
1answer
102 views

Ajax call or js to update a cart price

I am building a cart in Java and would like to give users the ability to update the quantity and see the new price instantly. I am using BigDecimal on the back-end for complete accuracy, but the ajax ...
-2
votes
0answers
13 views

Does the JSON parser omit empty arrays? [migrated]

I have a JSON like this: { "CODE" : [{ "FOO" : "BAR", "SET" : [] }, { "FOO" : "ABC", "SET" : [] } ] } Now, when I try to access CODE[0].SET, I ...
-4
votes
0answers
22 views

Change a Tag's Class with type submit through getElementsByTagName [closed]

I have this code: <input class="btn" type="submit"> <input class="btn" type="password"> <input class="btn" type="submit"> I want to change all input's class with type submit from ...
0
votes
0answers
12 views

JavaScript Print Formatting [migrated]

I'm learning NodeJS and rewriting some code to see how it compares. For one script, I am trying to take dates in the form of strings and turn them into JavaScript Date objects to perform calculations ...
11
votes
2answers
7k views

Is node.js a suitable server platform for financial applications? [closed]

Are there specifically any math related issues with Node.js and money that could cause my system to lose track of some of the money it's tracking? The reason that I ask is that PHP, because of it's ...
-1
votes
0answers
29 views

Preview hidden options on web sites [closed]

I want to have hidden options on my web site and be previewed only when the user chooses. I want to animate them from left and right (about 15%). At the moment I have them visible in my html but with ...
0
votes
1answer
80 views

Finding “spare time” in a day from within a list of events

I have a list of events which is always sorted chronologically. The start time is always followed by the end time. Times are strings formatted as 'HHmmss'. // list of events var events = [ ...
-2
votes
0answers
38 views

JavaScript filter PHP results [closed]

Hey guys for a while now I have been trying to come up with a method that can filter PHP results for listing items using JS. Look at these examples: http://www.autotrader.co.uk/search/used/cars/ ...
0
votes
1answer
140 views

Cheerp — C++ for web: advance or regression? [closed]

Recently I've run into Cheerp, a C++ to Javascript compiler, which uses a modified version of clang to generate Javascript code from C++ sources. That makes me wonder: why in the seven kingdoms would ...
1
vote
1answer
134 views

Web Application: Combining View Layer Between PHP and Javascript-AJAX

I'm developing web application using PHP with CodeIgniter MVC framework with a huge real time client-side functionality needs. This is my first time to build large scale of client-side app. So I ...
0
votes
4answers
167 views

Is client side JavaScript capable of replicating the Node.JS module loading system?

I like the Node.JS style of JavaScript, where I can write all of my functionalities into smaller files and then require those neatly from within my code. I'm even thinking about trying to write a ...
0
votes
2answers
99 views

Confused about javascript module pattern implementation

I have a class written on a project I'm working on that I've been told is using the module pattern, but it's doing things a little differently than the examples I've seen. It basically takes this ...
0
votes
2answers
53 views

Changing CSS classes when different strings are displayed in a text element with jQuery [closed]

I'm just wondering if this method would be possible using jQuery HTML and PHP. Basically I have a filtering system were products are listed, some have different attribute values such as Hatchback for ...
0
votes
0answers
164 views

What is the use of the prefix “for(;;);” in an Ajax response

After using the chrome debugger to inspect the ajax requests of Facebook (for curiosity), I noticed that the response is in JSON, however it is always prefixed with for(;;); In example, if the JSON ...
1
vote
0answers
68 views

JS closures - Passing a function to a child, how should the shared object be accessed

I have a design and am wondering what the appropriate way to access variables is. I'll demonstrate with this example since I can't seem to describe it better than the title. Term is an object ...
0
votes
0answers
54 views

How to bring an application from Sublime Text to a web IDE for sharing? [closed]

I generally work on my projects locally in Sublime Text but sometimes need to share them with others using things like Jsfiddle, codepen, or plunker. This is usually so I can get unstuck. Is there an ...
2
votes
2answers
148 views

Should I group all of my .js files into one large bundle?

One of the difficulties I'm running into with my current project is that the previous developer spaghetti'd the javascript code in lots of different files. We have modal dialogs that are reused in ...
2
votes
1answer
155 views

Is this JS code a good way for defining class with private methods?

I was recently browsing a open source JavaScript project. The project is a straight port from another project in C language. It mostly use static methods, packed together in classes. Most classes are ...
10
votes
3answers
1k views

What stops HTML5 and JS apps to perform as good as native apps?

From what I understand, HTML is a mark-up language, so is the content of XAML, XIB and whatever Android uses and other native UI development frameworks. JavaScript is a programming language used ...
0
votes
1answer
193 views

Application use on website

Is there a good way to run a C# application on clientside in lieu of JavaScript? I have done some front end work with JavaScript and backend C# for web developing at an old job, but I am interested in ...
41
votes
6answers
9k views

What are the pros and cons of Coffeescript? [closed]

Of course one big pro is the amount of syntactic sugar leading to shorter code in a lot of cases. On http://jashkenas.github.com/coffee-script/ there are impressive examples. On the other hand I have ...
1
vote
2answers
105 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 ...
4
votes
2answers
3k views

When to use event.initMouseEvent for simulating mouse clicks?

I wonder if there are benign use-cases for simulating mouse clicks using event.initMouseEvent. I found that it is used for creating pop-under ads in the following way: var e = ...
0
votes
1answer
74 views

Falsey values vs null, undefned, or empty string

I've worked with jQuery over the years. However, recently, I've found myself getting deeper into the JavaScript language. Recently, I've heard about "truthy" and falsey values. However, I don't fully ...
0
votes
0answers
6 views

Using Twitter share and Facebook share [migrated]

Hi I m trying to use Social Plugins in my website For a Tweet on Twitter <a id="twitter-link" href="https://twitter.com/share" class="twitter-share-button" data-lang="en" ...
0
votes
2answers
177 views

How would I implement this application idea? [closed]

I am a D&D gamer and a developer that has mostly worked with ASP.NET applications professionally. I have written some chat bots in Node.js and I have only played a little with PHP but wrote ...
-1
votes
0answers
12 views

Knockout custom text binding handler [migrated]

I created this custom binding handler : ko.bindingHandlers.line = { update: function (element, valueAccessor, allBindings) { // First get the latest data that we're bound to var ...
19
votes
6answers
1k views

Should I place functions that are only used in one other function, within that function?

Specifically, I'm writing in JavaScript. Let's say my primary function is Function A. If Function A makes several calls to Function B, but Function B is not used anywhere else, then should I just ...
2
votes
1answer
89 views

Uniform variable naming across HTML, CSS and JS

I'm sorry if this is opinion based, but how do you guys make sure that HTML, CSS and JS have uniform variable naming? I use vim, but I don't know if IDEs are smart enough to do this on their own. In ...
-1
votes
1answer
54 views

Deleting dynamic elements from a database [closed]

I have a select dropdown, with '+' and '-' buttons that add and remove items before submission. I would like to be able to remove the elements with the '-' button after they have been added to the ...
4
votes
1answer
82 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
184 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
127 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 ...
3
votes
0answers
79 views

Are promises suitable for Model Controller communication?

I have an Express app built with the Yeoman Angular fullstack generator to build an API to send JSON to Angular. I'm trying to work out the best way to pass back information from my model to my ...
0
votes
1answer
58 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 ...
0
votes
1answer
86 views

JavaScript: testing with undefined value

While learning more about IE’s documentMode property, I came across some sniffing code, which, of cause, fails in browsers like Firefox. However, a simplified version of the test would readas such: ...
9
votes
4answers
483 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
321 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 ...