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

Browser security and payments

I've been finding a lot of blog posts claiming JS encryption is unsafe, here's a couple of detailed ones: http://www.matasano.com/articles/javascript-cryptography/ ...
34
votes
2answers
3k views

Strategy for generating unique and secure identifiers for use in a “sometimes offline” web app

I have a web based project that allows users to work both online and offline and I'm looking for a way to generate unique ids for records on the client side. I'd like an approach that works while a ...
-1
votes
1answer
237 views

How to make C# methods work like javascript functions? [closed]

I'll keep it simple, I want to make C#'s methods work like javascript's functions. Mainly so I can convert this - function makeVariable(terp) { var me = {value: 0}; return function () { ...
3
votes
1answer
98 views

equivalence in callback and non-callback javascript

I'm pretty sure that the following two snippets are equivalent but I wanted to double check: CALLBACK STYLE function foo(input, callback) { // do stuff with input callback(); } function ...
0
votes
0answers
53 views

Using JavaScript to find the correct offset in bundled files

I am currently making multiple parsers using PEGjs and have implemented my own partial preprocessor which using a RegExp finds and replaces '#include' directives with the desired files, resulting in a ...
14
votes
2answers
651 views

Creating nested functions for purely aesthetic reasons?

I've always wondered what other programmers think about the idea of creating pure aesthetic functions. Say I have a function that processes a chunk of data: Function ProcessBigData. Say I need ...
2
votes
2answers
762 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 ...
52
votes
3answers
5k views

Why do JavaScript frameworks/libraries have functions which already exist in pure JavaScript?

I wonder why frameworks/libraries have their own helpers although they exist natively already. Let's take jQuery and AngularJS. They have their own each iterator functions: jQuery.each() ...
0
votes
1answer
150 views

JSON - Ruby objects key naming

Ruby object has method/property: def tentakles_count 8 end JavaScript object has key/property: { justEnough: true } Now, when JavaScript gets serialised ruby object via XHR or WebSocket, ...
0
votes
2answers
165 views

Minified version of JavaScript library under LGPL used on a site without copyright notice

On this site hackfind.com the autor put minified version of my library without any copyright notice. Is this violation of the LGPL. Note that using on a site is not a copy.
0
votes
1answer
131 views

What are security advantages of Google Caja over using the web worker API? [closed]

I am currently looking into Google Caja to run user-supplied JS code in the browser and in Node. So far, I understand, that, in a browser context, "cajoled code" disallows reading and messing with ...
1
vote
2answers
715 views

Developing a dynamic site with Node.js [closed]

I'm trying to get some pointers on what the best methodology to follow for a web application would be. First, some background: I've built two different APIs using Node.js where Node serves the data ...
-1
votes
1answer
164 views

design patterns in Javascript - toggle functionality [duplicate]

My goal is to add some functionality to the bxslider script - in this case, I want to be able to enable/disable a keyboard event handler AFTER a slider is instantiated. I guess this code is self ...
3
votes
2answers
530 views

Why do concurrent languages tend to have more complicated syntax?

This is a question that's been on my mind for a while. Recently I've been checking out concurrent languages like Haskell or Go or Erlang. From my point of view, they have huge benefit in performance ...
0
votes
2answers
144 views

Blocks of Javascript in Web Pages

I'm trying to find the best patterns for javascript usage in my sites, and in doing so I tend to look at source code at some sites (meetup.com, facebook.com, etc). One thing that sticks out at me is ...
0
votes
1answer
74 views

Preference to see if a field's value was changed js or linq object?

We have some requirements to send emails when various field values are changed in our system. It's an asp.net system using linq to sql with javascript/jquery. Is it preferred to check if a value ...
0
votes
1answer
201 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 ...
1
vote
1answer
214 views

Is parsing a submitted JSON object safe?

I have a RESTful API, built in NODE.js that does what you would expect it to: consumes data and then makes it accessible. Currently, data being submitted to my server is nested form data: ...
2
votes
1answer
202 views

Local Updates in Persistent/Immutable Data Structures

I'm getting into ReactJS and am intrigued but also confused about persistent data structures. I love the idea, but I'm not sure how to take my MV*, Mutable, Observable Bindings experience in designing ...
1
vote
2answers
93 views

JavaScript: Bundle a required, but common, polyfill in my library?

First, here are a couple of related, but not-quite-the-same questions: Should I include dependencies for which I have the source as projects in my solution? Depending on another open source library: ...
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 ...
1
vote
1answer
121 views

How does user confirmation box work?

How does the client know to send request to server only when the confirmation box result is ok and stay on page if cancelled? Also, is this mechanism any different in ASP.Net and ASP.Net MVC? I want ...
0
votes
0answers
105 views

Best practices in creating JavaScript styling API's: Balancing CSS and JavaScript

I have written a number of components for Durandal--DatePicker Widget, Tabs Widget, Radio Widget, etc. I'm having a little conceptual difficulty in how best to balance a styling API with CSS. For ...
6
votes
3answers
525 views

When and Where should we use hoisting in Javascript [closed]

I'm new to Javascript. I'm learning the concept of hoisting in Javascript. Based on the Javacsript tutorials in Mozilla website, I came across this word hoisting. According to those tutorials, ...
0
votes
2answers
2k views

Understanding Front End vs Back End Javascript?

I've been noticing lately, as I've played around with javascript, HTML5, and node.js for the first times that javascript seems to be a language that is used very differently (and with different ...
3
votes
1answer
127 views

Architecture for a template-building, WYSIWIG application

I'm building a WYSIWYG designer in Ember.js. The designer will allow users to create campaigns - think MailChimp. To build a campaign, users will choose an existing template. The template will have a ...
0
votes
1answer
72 views

how to manage new private variables introduced into class?

Whenever I want to add a new functionality, I introduce a new private variable into the class. Declare it just above the first method definition. leave a small comment. Set it in a certain method. And ...
0
votes
1answer
138 views

Building an organization-specific XML editor in HTML

I'm building a user friendly XML editor in HTML/JS. Looking for some general advice on how to build the editor UI and which approach you'd recommend on mapping the data to the UI. Details about the ...
0
votes
1answer
200 views

Twitter Bootstap: Backwards compatibility? [closed]

I work for a university Digital Services team. Our university's main website uses the Ektron CMS (I have my own thoughts about this, but that's irrelevant). Because we maintain a university website, ...
1
vote
3answers
567 views

What is the real difference between a minified and uncompressed file? What are the benefits of each?

I often see something like "uncompressed for development / minified for production" when reading blogs or downloading frameworks. What is the real difference between the two, and if minified is "good ...
2
votes
1answer
92 views

A* with possible multiple paths

Greetings I am currently studying pathfinding and I came across A* algorithm from this site https://github.com/qiao/PathFinding.js I tried to test A* with bi-directional and it is working great. ...
1
vote
2answers
216 views

Testing a very specific function in a large, complex application

I'm new to testing but wholeheartedly realize how important it is. The main issue is that my company has no top-down support for testing at all. That is we don't have any unit testing and just a bit ...
3
votes
2answers
168 views

messaging class and global state

This is a front end project that is using socket.io for all communication with the server. This allows for push which is good, but recently we have been asked to provide a pause button. The pause ...
0
votes
2answers
180 views

Proper way to structure JSON for front-end consumption

Having worked on several different web application code bases, I've seen some divergence in how back-ends serving JSON to front-ends structure that data. In particular, when a backend wants to return ...
0
votes
1answer
557 views

How does jQuery's mechanism of event handlers work

I'm in the need of widen my perspective on the framework libraries, to be able to make well aware choices of if/which/when to add a framework to a website. One thing that got my attention was event ...
0
votes
3answers
212 views

When/Where to create/assign event handlers to its elements

Lets say I have the following code // JS $(function(){ $('[data-mc=logout]').click(function(){ if (!confirm(myconfig.msg['asklogout'])) { return false; ...
1
vote
1answer
469 views

Global vs Individual object event handlers

Lately I've been studying a lot of javascript samples, both with/without libraries, jQuery to mention one. As an old JavaScript developer, I learned early to make use of unobtrusive javascript where ...
2
votes
3answers
469 views

Reasons for moving from pure JavaScript to a JavaScript library

Being aware of the direct benefits of libraries having things wrapped in a package, making daily work easier, my question is leaning more towards the fact that many features not implemented in ...
4
votes
5answers
284 views

Using π, φ, λ etc. as variable names while programming? [duplicate]

This is a function in the d3.v3.js file (the graph library D3.js): function d3_geo_areaRingStart() { var λ00, φ00, λ0, cosφ0, sinφ0; d3_geo_area.point = function(λ, φ) { ...
2
votes
2answers
207 views

I'm struggling with abstracting my animation code in my game using a functional style. How can I do this?

My game is a top down 2D shmup programmed in a functional style. I'm struggling with abstracting the code that is responsible for animating the projectiles. There are many types of guns with many ...
0
votes
0answers
34 views

Reasoning behind indexedDB versioning

So, the last 2 weeks I have been fighting with indexedDB and one of two recurring questions that keep popping up is why indexedDB has to use/present it's entire versioning system? I do understand that ...
2
votes
5answers
265 views

secure photos on server [closed]

I would like to hear advice from the more experienced developers. The project is now in the design stage. It's mobile application and a simple web application. Content is pictures, comments, personal ...
-2
votes
1answer
134 views

Why is an A element often used instead of a BUTTON for web design? [closed]

Is there any particular reason why people use the A tag to mimic a BUTTON in HTML and JavaScript?
0
votes
0answers
92 views

Keeping Backbone model in sync with editable view

I'm making a web form for editing some objects. I'll call these objects Foos. I have a Backbone model that represents Foos. I have a Backbone view that renders an editor form, filling in fields ...
6
votes
3answers
432 views

Is there a web-specific reason for the design choices behind the JavaScript language?

With the advent of "the web is the platform", JavaScript is fast becoming the most widely used programming language in the world. However, many tasks that are easy to accomplish in other modern ...
0
votes
3answers
182 views

Adding object properties using functional programming

I am currently learning functional programming using Underscore.js. What I want to do is add two co-ordinates together. Let P1 = (0, 0) and P2 = (1, 1). Therefore, P1 + P2 = (1, 1) I have a solution, ...
0
votes
0answers
257 views

Javascript design pattern with jQuery Widget factory

I am using the jQuery widget framework for creating some graphical elements on a webpage, and I have a conseptual question about the overall structure of the code. I have 3 classes A, B and C which ...
3
votes
2answers
754 views

Multiple var statements in JavaScript

Writing a single var declaration per function is considered to be good for readability and maintainability. But, when I went through some of standard libraries, their dev version doesn't strictly ...
4
votes
1answer
216 views

Designing storage service data structure for decoupled models sharing same data

Surely most of you remember the Norton Commander application where similar (sometimes the same) data is displayed in separate decoupled views. I'm building a web application that follows the same ...
0
votes
1answer
108 views

Switch / select case etc. compared to If … ElseIf … Else [duplicate]

I don't understand why the switch or equivalent is so popular in languages. To me, it seems like it had a place back in the days when the alternative was lots of nested if statements in the else part ...