ECMAScript (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms and stand-alone interpreters / JIT engines. Use this tag for questions regarding ECMAScript 5 or 6 and its dialects / implementations: JavaScript, JScript, etc., excluding ...

learn more… | top users | synonyms

-4
votes
0answers
7 views

Found this code and I can't seem to understand what it does [on hold]

I was working on a website my Dad's friend set up for my family using WordPress, and I came across an unknown admin account under Users > All Users. This user ...
1
vote
0answers
5 views

Userscript for easily replying in Stack Exchange chat

In SE chat, there are two different ways to mention people: A "ping" to just get a user's attention, and a "reply" that points out a specific message by the user. This script makes it so that ...
3
votes
1answer
18 views

Angular.JS table management

I am an Angular.JS beginner and this is my first application. I hope you give me some advices what to do to have better, optimized code. This application manages the data from database, shows it in ...
1
vote
1answer
28 views

Span decimal point precision

In a JSP page I have a number of Span elements. Each of this span element will be floating point numbers. All these span elements has class ...
1
vote
3answers
107 views

Functions that increment count variables and progress bars on button click

I'm just learning JavaScript and jQuery, and I've got some code that works, but I know it can be optimized. I have a page that when a button is clicked it adds 1 to a label, and then increments a ...
3
votes
2answers
26 views

Function which returns the smallest / largest numbers in a nested array structure

Given is an array which contains sub-arrays. The elements in this sub-arrays are numbers. The task is to implement a JavaScript-function which returns an array with the smallest / largest numbers in ...
1
vote
2answers
31 views

Check if a linked list is a palindrome in O(n) time and O(1) space

I liked this problem because there are so many sub-problems that are interview problems in their own right-- (reverse linked list, find midpoint) ...
3
votes
1answer
32 views

Simple object-oriented calculator - part 3

This question is an improvement I did based on recommendations from these other questions: Simple object-oriented calculator Simple object-oriented calculator - follow-up To those looking this ...
3
votes
1answer
38 views

JavaScript calculator for adding discounts on some number of people

I am trying to learn JS and I am trying to make a simple calculator which will calculate price against number of people and will give discount on some amount of people. For instance, every 6th person ...
2
votes
0answers
14 views

Wrapping a small animation library for Angular

I've started out working on a larger project using Angular for the first time. For visual feedback, I'm using Waves (Github) (you can see a demo page here). The standard way to use Waves is to ...
3
votes
0answers
16 views

Return four spreadsheets of Google Analytics account, property, profile, and filter information

Scenario goes like this: User enables plugin from within Google Spreadsheet Authenticates with their Google Analytics Account They select which accounts they'd like to perform an audit on Four ...
0
votes
0answers
16 views

Angular Pagination Directive

I wrote this small pagination directive after having to do something similar for an app I'm writing. For the app I wanted something that would be flexible and could be reused just about anywhere. ...
1
vote
2answers
47 views

Checking if an element exists in an array efficiently and return it

I am writing a function for my node/angular app that will prompt the user with a random question that he was not asked before. To achieve this I wrote this function: ...
5
votes
2answers
60 views

Hours:Minutes Addition

I wrote this simple page to help at work, and as an exercise to get more familiar with JavaScript. I'm especially interested in help with style and structure - is this "standard"? I know the input ...
4
votes
2answers
163 views

Follow up - Creating Inheritance hierarchy using function constructor

In continuation with this question, Animal class has four fields: name sound ...
3
votes
0answers
25 views

Checking a user registration form before sending

I think this isn't right way. Maybe you can suggest something about error-displaying in error-container which fill in JS. index.html ...
3
votes
1answer
32 views

PHP script for getting post data from Tampermonkey script

I'm trying to shorten this piece of my code into a loop: ...
8
votes
2answers
465 views

A “C” shape of 7 boxes that turn green on click

Company name asks you to build a website with 7 boxes shaped like a c, which should turn green on click, and then when all are clicked, should turn red in reverse clicking order. ...
-4
votes
0answers
26 views

Iterating through a multidimensional java-script array [on hold]

for a board game I am making I have this example array for winning patterns: ...
12
votes
5answers
685 views

Check whether string ends with string

I wrote the following to check whether a string ends with a second string. ...
0
votes
1answer
21 views

Form validation using IIFE and closure [on hold]

Problem statement Write an IIFE in which we have to validate the input provided from a form using closures. The form consists of name, email, phone, address in which name, email and phone ...
0
votes
2answers
41 views

Write an anonymous function validating email address

Problem statement Write an anonymous function which take email address as parameter and returns true/false after validating the input parameter. Objective This assignment will help ...
6
votes
2answers
77 views

Simple object-oriented calculator - follow-up

This question is an improvement I did based on recommendations from this other question: Simple object-oriented calculator JSFiddle ...
12
votes
2answers
133 views

OLog Userscript - Logging messages, planets and researches

For the online text-based browser game OGame I am working on an application with as aim to assist the users where possible, for this I have a server-side part and a client-side part, the respective ...
5
votes
1answer
67 views

BigBrother - A chat room watcher

Originally, this script stemmed from a small script that watched stars and who made them, but a few days after launching, SE patched it so the people behind the stars aren't sent. Regardless, ...
7
votes
1answer
29 views

React & ES6 news app

I have written a small app that fetches news items from an endpoint and displays them in a grid. I used React to create components and use them throughout the app. This is the first thing I have ...
2
votes
2answers
27 views

Extracting distinct HTML list items into a JavaScript array

This code is made to generate a list of unique elements of the array made of the other two arrays. The fact that we need two lists to convert in two different array is part of the task. This code ...
5
votes
3answers
150 views

Generate Symmetric Ascii

Have you got any suggestions to improve this code? The idea is to generate a one-line string that is visually symmetric. Revisions at Github ...
3
votes
0answers
41 views

Better way to toggle between the state of show() and hide() in jQuery

I have the following code which switches between the states of hide() and show() of show prices ...
3
votes
1answer
22 views

Implementing the “Thinking in React” example from React documentation without using Refs

I'm quite new to React and was working through the "Thinking in React" example, I noticed they used refs for updating state, but I also read on SO that using refs isn't that good in the long run, so I ...
21
votes
4answers
248 views

Simple object-oriented calculator

After studying several ways of doing OOP in JavaScript I think I finally came up with one that seems OK to me. Is it okay? Do you see some problems I can face by using OOP in JavaScript like this? ...
5
votes
1answer
27 views

PHP Image Uploader

I have a website, where one of the options that a user gets is to change their avatar. I would like to know if there is anything that I shouldn't or should be doing... So here is what I've got. Here ...
4
votes
0answers
24 views

AngularJs Module Run Block, Configuration, and Route Definition

My AngularJs app is currently working fine. I'm working on modularity, refining my code design, and making it more readable. I have a app.js file that contains the ...
7
votes
1answer
33 views

Refactoring a phantom server called Swayzee

I have made a tool that is pretty useful for me. I have made it open source on github. It is a server that listens for requests and returns an HTML static version of a single page app. It works with a ...
0
votes
2answers
68 views

Can my responsive-tables JS code be made more performant?

I was using dataTables.net's responsive plugin before this, and am happy to say that my (much simpler) code runs about 5 times quicker than that did. On my machine the fiddle averages about 50ms ...
16
votes
7answers
1k views

Find the longest word's length

The challenge is simple: Return the length of the longest word in the provided sentence. The solution is just as simple: ...
8
votes
1answer
62 views

Populating many fields in a form using jQuery/AJAX

I have the following code which sets input values using jQuery/AJAX. Can the repetition of the code be shortened in anyway? It's mainly the AJAX requests I'd like shortened. It doesn't seem right to ...
4
votes
0answers
17 views

Angular controller scope inheritance vs service

On my site I have a navbar component that I want to customize for each and every ng-view I end up loading. Currently I'm doing ...
-5
votes
0answers
8 views

missing $id in firebase snapshots [closed]

I'm using firebase with angular and having an issue with snapshots. i get all the data i'm looking for except the $id is missing from the data. in my controller i have: ...
8
votes
3answers
306 views

Drawing a grid on canvas

I have created canvas (800x400) - and filled it with a grid. It works but the rendering of the grid (lines) takes around 3 seconds, which seems excessively long. Am I doing something wrong? ...
5
votes
1answer
71 views

Reducing a large array of objects to a simple object with 8 properties

I'm reducing a large array of objects to a simple object with 8 properties. I'm currently using Array.prototype.reduce to loop through the array of objects to ...
0
votes
1answer
45 views

Angular JS $HTTP for nested array

I'm using a factory for my $http get requests. When I pull single json objects from the $http, it works pretty quickly I now have items coming through as an array. It is very inefficient, & ...
15
votes
2answers
93 views

Stack Exchange Post Reminder

I've created a UserScript for adding follow-up reminders to any post (question or answer) here on the Stack Exchange network. I did this in response to a stackoverflow meta post feature request which ...
13
votes
2answers
337 views

“War” card game which includes betting “money” as well

I have created a Javascript based game, which is based on the card game War. I think I am reusing a lot of my code, but I am not entirely sure what I can really improve. I have a lot of functions, ...
5
votes
2answers
92 views

List all repeated substrings with a fixed length

While fiddling around, I've made a very simple and naive function to retrieve any repeated sub-string within a certain string. ...
4
votes
1answer
30 views

Binary to ascii mapping in JavaScript

This morning I've seen this on Twitter: http://mynewtechworld.tumblr.com/post/135545896048 I case that somebody can't see the image: I 01101100 01101111 01110110 01100101 you. Just ...
5
votes
1answer
52 views

Sails.js controller method for an admin to update a user account

I am new to Sails.js, Node.js, and web application development in general. My current understanding is that well-written controllers should be "skinny" meaning they should be as simple as possible, ...
5
votes
0answers
44 views

An object exposed to directives that need to track changes on it

This is an object exposed to the view and is being used on directives within the same view. The directives need to track changes on the ctrl.filters.applied object. ...
3
votes
0answers
13 views

Min-Heap based priority queue class written in ES6

I would appreciate any feedback on syntax, naming convention, possible shortcuts, clarity of code and any other constructive feedback. This code was based off of the Priority Queue chapter in The ...
-1
votes
1answer
38 views

template for checkers game for single player

i make template for checkers game. while there is the functionality for only one player. but it worked. Checkers can already move ...