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.
0
votes
1answer
24 views
Should I prefer classes or singletons in JavaScript/Node?
This question applies especially to Node.js, but also to JavaScript in general.
I started working on a simple web app in Node.js. I'm relatively new to Node and JavaScript, and come mainly from C# ...
-1
votes
0answers
17 views
All li elements move together [migrated]
<!DOCTYPE html>
<html>
<meta charset="utf-8"/>
<meta name="author" content="Nikos Efthias"/>
<link rel="stylesheet" type="text/css" href="css/a.css"/>
<script ...
-3
votes
0answers
13 views
Extracting value from a matrix [on hold]
So I'm trying to extract a specific value from a matrix. For example I have a 2x2 matrix as following:
[ [1, 2], [3, 4] ]
How to index the element with value 2 from this matrix?
0
votes
0answers
22 views
Deleting all cached page of the site
Scenario
Mobile and desktop version.
I'm developing a website with a desktop and a mobile version: users can choose to switch version if they want to: javascript will save a cookie telling the ...
5
votes
3answers
203 views
Is prototypal inheritance inherently slower?
I see Javascript 6 will add traditional class based inheritance, and one argument I hear is that classes are inherently much faster than prototypes because they can be optimized away by the compiler ...
-1
votes
0answers
31 views
Direction for MEAN web development [on hold]
I want to develop a web application using the MEAN stack. So I started off with Web development with Node & Express and had to quit in between as it did not cover the front end Angular and ...
-2
votes
0answers
20 views
Javascript Coding for use in Adobe Acrobat Professional [on hold]
I have been looking into creating custom dynamic stamps for use in Adobe Professional.
I have got as far as creating the custom text fields and positioning them over the image which I want to use as ...
-3
votes
1answer
85 views
Web developers skill set requirement [on hold]
we want to make a web application that is composed of reusable components. We are using AngularJS framework for JS. The methodology of working is Html Css is developed then the JS and backend ...
0
votes
1answer
80 views
Multi Room Chatroom Architecture [on hold]
I'm building a multi room chatroom app, with some extra features that go beyond a few methods/calls.
I'm wondering if I should:
Manually create every method call on the clients and servers, which ...
-2
votes
0answers
10 views
javascript variables not defined in IE11 but defined in chrome [migrated]
There is a namepicker which is not functioning properly in ie11 but works fine in chrome.
On inspection i found that the variables are undefined in IE11 but are defined in chrome.
i used the alert ...
0
votes
0answers
16 views
Need to add websocket support to a single page that's running a wsgi service
Current setup. I have a legacy ERP system (Thoroughbred) and i then have several in house applications (CRM, WMS) and a website that interact with it via an xml server and straight ODBC connections. ...
1
vote
2answers
68 views
Literal strings vs. object properties in JavaScript
JavaScript libraries in the same space (UI widgets) use two different approaches for instantiating components:
Literal strings to specify types, and inlining as much as possible, for example:
var ...
1
vote
2answers
49 views
How to make scalable modules in a div element
I'm interested in creating web modules that are encapsulated by a div element in a manner that, by simply resizing the div, everything in that div scales to the dimensions of that div proportionately ...
0
votes
0answers
29 views
Measure and locate areas of similar value in an image
I saw this picture online and wanted to see if I could create an algorithm to give ordinary images an effect like this:
http://justinlivi.net/wp-content/uploads/2011/01/Living_In_Digital.jpg
My idea ...
0
votes
2answers
72 views
Should refactored functions go inside the calling function? [closed]
I like to divide my functions into small parts; it tends to make the code look cleaner. In most cases, the extracted parts are only used by the 'containing' function. For example in C#:
private void ...
2
votes
2answers
117 views
Why is the Document Object Model the view?
I was told by a Javascript programmer not to do DOM manipulation in model code.
I also remember hearing a snazzy tune for a JS framework (I forget which one): "Get your models out of the DOM".
This ...
-3
votes
0answers
41 views
What examples are there for mean.js? [closed]
Is there anyone with a link to examples for the mean.js framework other than the bossable videos that are on youtube?
-3
votes
0answers
37 views
What cms to use for mean.js? [closed]
Does anyone has any suggestion for a cms (preferably javascript based) for mean.js? I couldn't find any example that shows mean.js integrating with wordpress or drupal.
0
votes
0answers
59 views
Reason why client-side JavaScript does not allow access to POST/PUT/etc contents
Is there any theoretical reason why client-side JavaScript could not be spec'd to allow for direct access to POST or PUT contents without need for a server language to write it into client-side ...
0
votes
2answers
121 views
Will ES6 promises replace libraries like Q and Bluebird? [closed]
How do built-in ES6 promises compare to existing userland promise libraries?
Will there be advantages to using the new built in ES6 promises over established libraries like Bluebird?
Will promise ...
0
votes
1answer
47 views
Choose approaches for updating an object
Say I have a simple object created by from user input:
var input = { url: 'http://example.com/', path: 'abc', user: 'adam' };
And I am to write function(s) that update url and path properties ...
1
vote
1answer
165 views
Using streams to connect programming languages
I'm trying to run a computation-heavy program that creates an image on a website. Is it possible to compute in C++ and have an output stream that connects to an input stream in Node.js to display an ...
0
votes
0answers
35 views
Login Tokens Remote DataServer for use in a Javascript/HTML-PHP environment
I've asked this question on stackoverflow, but i think this is a more appropriate place for it.
I'm creating an app for iOS, Android and the Web. I created a separate Restful Data Service that is ...
0
votes
0answers
46 views
What's the Difference with these Knockout Viewmodel constructors?
When creating a viewmodel for Knockout, what's the difference here? I see these different implementations and I've tried a few and some don't work the same.
//the most common example.
function ...
2
votes
3answers
590 views
Why is it a good practice to keep Javascript code in separate files?
In web development we are commonly used to keep Javascript code in separate files, but sometimes we need this Javascript code to manipulate server side data locally.
For example, making an Ajax Call ...
1
vote
1answer
114 views
What are the benefits of using new over closures
I've been programming in JS for over a year now, mainly in angularJS. And I can honestly say I've never made a function use prototypical inheritance. When ever i need a class like object that has ...
2
votes
2answers
347 views
should I test this public method
I have the following simple implementation:
var VALIDATION_TYPES = {
ERROR: 1,
WARNING: 2
};
var validationRules = {};
this.addErrorRule = function (event, rule) {
...
0
votes
0answers
3 views
cannot set project's JavaScript Build Path in PHP- eclipse [migrated]
Completely new to eclipse-PHP-javascript.
I have created a php project in eclipse and trying to set up the javascript Build Path after enabling javascript support for the project
The problem arises ...
-1
votes
0answers
25 views
how do I convert a image to it's rgba values to write to a canvas? [migrated]
I wrote a utility to convert text to colors and back on a canvas(This Part works great.)
The code which inverts and grayscales a canvas is the issue.If I use drawImage on the canvas and try to call ...
13
votes
7answers
2k views
Is there a pattern for a more “natural” way of adding items to collections? [closed]
I think the most common way of adding something to a collection is to use some kind of Add method that a collection provides:
class Item {}
var items = new List<Item>();
items.Add(new ...
0
votes
0answers
17 views
What is an efficient method for retrieving a column from a 1D array? [migrated]
An example in any language would help, though in the end I am going to be using either Ruby or JavaScript/CoffeeScript.
Basically, I have a 1D array of pixel values. For example, I have an array ...
0
votes
0answers
24 views
Performance increase by only attach onblur handler inside of onfocus handler?
Given a web page with input fields, does it have a performance difference whether or not you assign the onblur handler inside of the onfocus handler like so:
var inputFields = ...
0
votes
2answers
146 views
What is the best way to create dynamically a DOM?
I know that there are plenty answers to this question on stackoverflow, but I can´t find one that give me an answer that can help me to solve a question that came out after read a lot of Javascript, ...
-3
votes
2answers
100 views
How to convert a number into sum of numbers of specific length
I am trying to convert a number(x) into array of numbers so that their sum is equal to the number (x), but the array length should be equal to the given length.
var x = 12
length 1: [12] = ...
2
votes
0answers
150 views
Is obtrusive javascript required to support a feature of angular.js?
I'll start by saying I'm just learning about Angular.js, and I was reading this article, which seems to advocate for obtrusive javascript as the right thing:
...
0
votes
1answer
83 views
How should I structure an application containing business logic and display? [duplicate]
I'm working on a simple board game that will run in the browser. I'm thinking how to structure the program and I'd like to hear your opinions.
The program will consist of the user interface part (the ...
0
votes
0answers
135 views
JavaScript program design: to what degree should I separate logic and display?
Consider you wanting to implement a simple game of checkers. There would be a rectangular game board and the player would able to move the pieces around according to a particular set of rules.
...
0
votes
4answers
231 views
Identifying user of a webapp
For a small webapp I want to be able to identify a user.
The issue is, if the user cheats in some manner, I want to be able
to forbid him the usage of my application.
I already have done extensive ...
2
votes
1answer
116 views
Why do browsers clamp timeouts and intervals?
I've been working on some abstractions of setTimeout and setInterval in order to process large sets of data without blocking the event loop in the browser.
Upon this, I have discovered that browsers ...
0
votes
3answers
185 views
Online code editors programming language
When searching for online code editors (out of interest how all the course sites such as Codecademy has been made) I noticed they are all been written in JavaScript.
Why are all those code editors ...
0
votes
0answers
18 views
Why does JSF not tend to render specific value to constant in some tags
This question is about JSF concepts or architecture; probably I don't understand enough to be more specific.
There are some ways to pass parameters to commandLink actionListener. But there are no ...
1
vote
2answers
376 views
Is it possible to protect client side algorithms 100%?
If you had a pretty novel idea that involved a new algorithm. Like lets say you were the first person to think of orbitz.com or kayak.com (travel sites) and you were able to and wanted to implement ...
213
votes
7answers
17k views
Does using == in JavaScript ever make sense?
In JavaScript, the Good Parts, Douglas Crockford wrote:
JavaScript has two sets of equality operators: === and !==, and their evil twins == and !=. The good ones work the way you would expect. ...
3
votes
2answers
65 views
Is it reasonable to have grunt/gulp build phases in javascript dev environment
Nowdays it's goes to be very fancy to have grunt/gulp build phases who concatenate and minify and organize javascript code.
And I agree that this is important for production.
But as a developer, I ...
-4
votes
2answers
64 views
Converting Web Apps to Smartphone Apps [closed]
Suppose I have an open source web app like this one (it's an IRC web chat client written entirely in javascript). Would it generally be an easy process to convert this into an iOS/android app without ...
0
votes
1answer
94 views
Do I need Bower for front end dependencies when I am already using composer?
I use composer for PHP dependencies. I was under the impression that for front end dependencies I should use Bower. So, I installed Bower and loaded my FE dependencies (Bootstrap, jQuery) using that. ...
3
votes
1answer
90 views
What is the correct way to publish a runtime? Should it be a singleton?
I have a compiler for a programming language that targets JavaScript. That language needs some global functions such as: alloc, memcpy, write and so on. My question is: where should I position those ...
0
votes
1answer
43 views
Ideal export in terms of size for asynchronous module definitions in JavaScript?
When creating AMD modules you can export whatever you like whether it be an object or a function. I vaguely recall reading a recommendation somewhere to export just one thing; the idea being "keep it ...
1
vote
1answer
119 views
Relatively large data on client side in web application
We are discussing on building a web application where (as per clients requirement), there will be relatively large data (60,000 items) to be shown as tree view.
Let's assume each item is string of ...
3
votes
1answer
111 views
How do I create a modal service with AngularJS?
I'm trying to make a service that's polymorphic based upon what mode is specified in the URL. If the char param in the route is set to 'p', I want to use a PresentMode service. If the char param is ...