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
2answers
40 views

What are the tecnhical reasons for email HTML, CSS, Javascript limitations and their persistance

If you've ever made a custom email you'll know that there are significant limitations in you need to be aware of. The most obvious limitations being: No support for Javascript in emails No support ...
-4
votes
0answers
29 views

Working knowledge of HTML, CSS, JavaScript, C# and SQL Server [on hold]

What does it mean if a employer asks if you have working knowledge of HTML, CSS, JavaScript, C# and SQL Server?
0
votes
1answer
85 views

Declaring many times: script type=“text/javascript”

Trying to clear my HTML code, is it correct if in my web page I declare many blocks of <script> . Like this: <script type="text/javascript"> ... ... </script> <script ...
0
votes
0answers
34 views

Should there only be one controller per page within a JavaScript-based MVC architecture?

Let's say that I create a page in my marketplace web application where buyers can see a catalog of all products offered by some or all sellers or sellers can see just their own products in a preview ...
-1
votes
0answers
33 views

Most common use cases for task runners [on hold]

Often I see company job descriptions list task runners as a preferred skillset. Some of the companies that list this are sometimes seen using a framework like Rails which has its own asset pipeline, ...
0
votes
0answers
50 views

Using Singletons in JS with workers

I'm building a javascript application that does continuous drawing, but relies on asynchronous scripts in the background which also need to poll for events and write to "global variables". This got me ...
4
votes
2answers
135 views

Dealing with browser cache in single-page apps

I'm trying to figure out how to properly handle the web browser cache for single page apps. I have a fairly typical design: several HTML, JS and CSS files implementing the SPA, and a bunch of JSON ...
0
votes
0answers
36 views

Scale parts of image to fill bezier path with no wastage

I want to be able to take an image and stretch/contract each pixel row (or 5 rows for performance) to fit within a curved shape. I've been searching for this for the last few days and have turned up ...
0
votes
0answers
57 views

What kind of design pattern for an “investment” system? [on hold]

I'm developing a browser game with Node.js. I'm trying to make an "invest" function, letting users invest according to their balance. For example: A user came and invested 20 dollar %40 of ...
-5
votes
1answer
58 views

Preventing a Javascript object function called twice [on hold]

I am trying to reuse an object but my function is getting called twice. Here is what I have: var KEYBOARD = { template: 'keyboard', getkeyboard: function(){ console.log(this.template); } } ...
0
votes
1answer
62 views

Backbone vs Angular/Ember for a 1-3 person development shop? [closed]

We are a really small (1-3) Ruby shop building a Rails application and need to pick one of the 3 (we've narrowed down to) JS Frameworks. Assume plenty of development experience overall but very little ...
0
votes
0answers
99 views

How to code a function to be used with or without callback on Javascript? [migrated]

I'm wondering how (if possible) I can create the same function, with exactly the same functionality, but to be used with a callback or without it. Here is an example with the "wanted effect" that is ...
-2
votes
0answers
20 views

How do you make the node_modules folder read/write in WebStorm [migrated]

I'm using WebStorm on a Node.js project and want to edit the files in the node_modules folder but WebStorm won't allow this. I found the padlock at the bottom right on the IDE but switching that ...
1
vote
0answers
157 views

Client side web application architecture - best practice & patterns [duplicate]

I'm inheriting some code that takes a rather different approach to architecture than I'd have chosen myself. It consists of a HTML page, some javascript library imports and a single DIV tag. This ...
-1
votes
1answer
83 views

Is there a way to run javascript on a present webpage [closed]

I don't have programming background. I have started learning javascript recently. I'm wondering if there is a way to run javascript on a webpage ? for example I would like to write a javascript on ...
0
votes
1answer
74 views

How to lock/unlock a button based on tweeting

I have a button that will be disabled until you send out a tweet that I have crafted. Only users with twitter accounts will have access to this, and I will require users to sign-in to be able to ...
0
votes
1answer
49 views

Common techniques to integrate social media login to a website that requires account registration

I have developed websites where users would register with a username of their choice and an entry would be created in a database table that holds their username and some sort of salted password. They ...
0
votes
0answers
76 views

What does this javascript file do? Is this a virus? [migrated]

While searching on google I found a website that shows other content to Google Bot and other to his users, and also a very suspicious javascript file. Maybe it's a tracking cookies virus/malware, I ...
-1
votes
5answers
232 views

Can we use `a <= x <= b` to check if `x` is between `a` and `b`? [closed]

How to give conditions for geographical directions based on degrees? for COMPASS API Reference... I have tried this...but not working if((0 <= a <= 22.4) || (337.6 <= a <= 360)){ ...
1
vote
0answers
99 views

How can I put multiple hierarchical forms in a single web page and avoid making it a mess?

We are a group of developers working on a web application that accepts forms filled and sent by our users and present it in an overall view. Our main form view looks like this: There are multiple ...
1
vote
1answer
49 views

Is doing Parent.call from the child object a right way to implement Inheritance in JavaScript?

I came across this piece of code it didnt look that right to me. Is it the right way to implement SUPER in javascript. if not what is the right way? function Person(name){ this.name = name; } ...
0
votes
2answers
104 views

In Node.js, are non-blocking constructs usually preferable to blocking ones?

Is the following a statement of best practices in Node.js with regard to web applications? If not, how could it be improved? The statement The lifecycle of any web app has at least two phases: a ...
1
vote
3answers
300 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 ...
0
votes
0answers
109 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
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 ...
1
vote
1answer
232 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
1answer
106 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 ...
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 ...
0
votes
1answer
83 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 = [ ...
0
votes
1answer
154 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 ...
0
votes
2answers
64 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
167 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 ...
2
votes
1answer
165 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 ...
1
vote
3answers
171 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 ...
1
vote
0answers
75 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 ...
2
votes
1answer
93 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 ...
4
votes
1answer
87 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
2answers
130 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
61 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 ...
3
votes
0answers
82 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 ...
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 ...
0
votes
4answers
174 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 ...
9
votes
4answers
495 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 ...
2
votes
2answers
134 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
103 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 ...
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 ...
0
votes
2answers
156 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 ...
0
votes
2answers
115 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 ...
-3
votes
1answer
302 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
102 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 ...