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

What is the normative (best) use of Javascript arguments object [on hold]

JS offers the 'arguments' object inside of functions to represent all passed arguments. Is there any broadly accepted concept for when/where this should be used? I've seen items like this in the ...
0
votes
1answer
145 views

Is class with callbacks a code smell in JavaScript?

When writing JavaScript (especially in node.js), I tend to use plain functions and callbacks. However, sometimes there's some context to share between some functions and I don't like to pass this ...
0
votes
1answer
195 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 ...
-5
votes
0answers
27 views

Annoying white background in html [on hold]

So I put an image into my site using the tag, but the thing is I set a background image using css, and now the image I inserted has this ugly white background that covers my background. If anyone ...
-1
votes
0answers
75 views

What is the best way to manage (limit?) memory usage in Javascript? [on hold]

Back in time when I had to allocate and deallocate each byte in my software, I had a good picture of memory usage in my mind. But now I am always uncertain. All those cross and circular references, ...
2
votes
1answer
397 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
3answers
574 views

Is $.proxy a code smell?

I've been writing most of my javascript applications in an OO style close to what I would use for most other languages. However, this means that most callbacks need to have a reference to an object, ...
-7
votes
0answers
49 views

As a newbie web developer, should I start learning ES6 straight away and skip “old” javascript? [on hold]

First of all I am newbie in the area of front-end web development so my questions and thoughts might sound naive to experienced guys. My background is .NET/C#/WPF for 5+ years but I started getting ...
13
votes
5answers
1k views

Genetic programming [on hold]

I recently was browsing Reddit and came across a post linking to a "JavaScript genetic algorithm" example. I've really been fascinated with the concepts of genetic algorithms and programming, however ...
-4
votes
0answers
18 views

converting image to rgb string [on hold]

I am making a movie in Khanacdemy processingJS, and am trying to decode an image. I have an array for my image where each color is assigned a number. how can I convert an image to this string of ...
0
votes
1answer
130 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 ...
7
votes
3answers
4k views

Building web apps in server-side vs client-side vs hybrid? [closed]

There are currently multiple approaches for building web applications: 1. Server-side only This is a classical approach where you render pages on the server by a web framework like Ruby on Rails, ...
78
votes
3answers
20k views

Pros and Cons of Facebook's React vs. Web Components (Polymer)

What are the main benefits of Facebook's React over the upcoming Web Components spec and vice versa (or perhaps a more apples-to-apples comparison would be to Google's Polymer library)? According to ...
1
vote
0answers
71 views

How to tell that a Javascript code already needs AMD (RequireJS, …)?

At some point code is complicated less if you introduce a new abstract than if you continue as it was. Some trigger should fire in a head of a programmer. Like, I was coding fine, but now I've added ...
-5
votes
0answers
80 views

Need Framework idea [closed]

I have much experiences with PHP, Javascript and CSS. I have coded much things in these two languages, but I want to code a Framework in one of these languages. Any of you guys have an idea what you ...
0
votes
0answers
24 views

Why can't I use parens when executing function in return object? [migrated]

Can someone explain why, if I add parens to _start in the return statement I get the error: undefined is not a function _start is function, is it not? .factory('TrackPage', ['$location', ...
1
vote
1answer
181 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 ...
-4
votes
0answers
29 views

Sync code after compressing and uploading [closed]

I have made an android app using javascript and phonegap. Now when its final and i want to upload it on play store, i want to compress its code to reduce its size. Now as my code is synced to github, ...
-2
votes
0answers
18 views

hide url param cakephp with refresh [migrated]

how do you hide / unhide / mask URL query parameters in cakephp? I've tried with javascript but still error when I tried the following pages of his. http://www.mywebsite.com/web/index/page:2?url=web ...
0
votes
2answers
127 views

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

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 ...
2
votes
2answers
208 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 ...
0
votes
1answer
233 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 ...
25
votes
14answers
7k views

What benefits are there to native JavaScript development? [closed]

Given how much simpler jQuery development is, when compared to native JavaScript, what makes people forgo libraries like jQuery altogether? Is this because jQuery has limitations or it is slow? I ...
1
vote
3answers
174 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 ...
4
votes
2answers
158 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
1answer
92 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 ...
1
vote
2answers
121 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 ...
0
votes
0answers
39 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 ...
0
votes
0answers
54 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 ...
2
votes
1answer
142 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 ...
0
votes
0answers
38 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
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 ...
12
votes
7answers
2k 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 ...
-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 ...
0
votes
1answer
62 views

Creating a voting platform for submissions during timeperiod

I have a site where stories are submitted at any time by users. The staff would like the ability to create a voting period at any time. For example, they can choose to open up voting from today until ...
1
vote
0answers
158 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
85 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
3answers
504 views

How to approach multiple page form with just one save option

The screen shot shows the magento product upload page. The left nav allows you to switch to different options for the product. Basically each option in the left nav appears as a different page. ...
0
votes
1answer
75 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
53 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 ...
50
votes
14answers
5k views

Is it a bad idea to return different data types from a single function in a dynamically typed language?

I come from a statically typed language background (Java). In Java, you have to return a single type from every method. For example, you can't have a method that conditionally returns a String or ...
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
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
51 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
106 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 ...
0
votes
1answer
1k views

Looking to create a custom, graphical editor for a data model using HTML5 and SVG

I need to create a graphical editor for our data model that works in an HTML5 compliant browser. I am looking for a proper library/framework to build on. The model is stored as xml, but that should be ...
8
votes
5answers
3k views

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

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 ...
1
vote
3answers
307 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
234 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
231 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 ...