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

1
vote
0answers
4 views

Single request weather app using ForecastIO service

I needed a web weather for a app that talks to ForecastIO API. Basically that senta request to https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE that gives ...
0
votes
0answers
7 views

Pull GeoJSON data for an API Request [on hold]

I am using a census API module from CitySDK. I am getting an error in my javascript console. When I load the page the, no data is there. I am attempting to pull the data and display it on a webpage. ...
0
votes
0answers
11 views
0
votes
0answers
6 views

Issue with $route in angular js [on hold]

I have been writing an electron app with angularJs. i am using the $route to switch between views but my views dont show up. i have been trying to fix it for 4 hours.please can anyone help?.here is my ...
2
votes
2answers
27 views

Implementation of insertion sort in JavaScript

I have written an insertion sort algorithm in JavaScript: ...
0
votes
1answer
55 views

JavaScript DOM modification

I'm thinking about DOM modification performance. In a perfect way, we alter each element but DOM modification is really heavy and alter many elements at same time froze the browser. I didn't make any ...
0
votes
1answer
29 views

JavaScript to parse json that can be, string, object and array

I have to parse a json object that can be a string, array, array of strings and array of object. I realised that it's not good from the beginning that one object can be many types, but I can't change ...
4
votes
1answer
30 views

Takes function and throws exception if passed function doesn't throw an exception

The code below is part of a toy test assertion library I've written. I'm looking for feedback specifically on lines 4 - 9. I'd like to extract them from the ...
2
votes
0answers
21 views

Factory to augment JS classes with validation methods

I have some validation classes. To keep things smooth, I create a single class that has those validation classes inside of it. That class will be a singleton, and gets injected into my other classes. ...
3
votes
1answer
40 views

JSON API client to manage user accounts

I have the following class in Typescript (using the Aurelia SPA-framework). ...
3
votes
2answers
36 views

JS cross-fade transition

As the question says....Can this be done any better? I could introduce more variables to cut down on function number, but does it make sense? So this is a simple cross-fade between two images : ...
1
vote
2answers
41 views

Simple JS validation for two contact forms

I'm not a pro in js so, my code is a mess (but it's working!). I would like to ask your help to reduce some redundancies in two cases. Those two are codes are affecting these two forms: ...
-1
votes
0answers
10 views

Fade out text, then show again repetadely in JQuery [on hold]

Hey I'm new to JQuery and want my website to look nicer by having a repeated fade out effect with the text, and maybe eventually fade in also. So I set up a system that is called when Fade out Is ...
7
votes
2answers
49 views

Contra - 30 More Lives

Just for the fun of it, I wanted to have a hidden keypress function on my website that performs an event when the user types in the Contra code for thirty lives. I'...
0
votes
0answers
9 views

Polymer decorator to make iron-forms actually work

I just finished writing a first version of hot-form. It's a simple decorator that makes iron-forms do I basically always do: Show error messages, or a custom ...
6
votes
1answer
95 views

My minesweeper implementation in Javascript

I'm beginner coder and I would like to request for critique review of my minesweeper implementation. Game was made using bootstrap 3 and game board itself is a simple html DOM table. Game is complete ...
0
votes
0answers
10 views

Need to Trigger the calculation of work timings by windows lock [on hold]

I have written a script in HTML using JavaScript to calculate my work time in the office. Please find my working code below for reference. In this I need to click on the pause button manually when ...
4
votes
1answer
59 views

Stack implementation in ES6

Finally happy to see that now we can have iterators and generators. I also need to try to have private properties too so that we have well encapsulated data structures and I see that there are Proxies ...
3
votes
1answer
51 views

Knapsack algorithm in JavaScript - Integer weights and values

My version of Knapsack works only when the weights or values of items are whole numbers. Restrictions You are given an array of objects each of which contains a weight and value. You are also given ...
1
vote
1answer
48 views

Interpreting the time

EDIT: Alternate answer on overflow: http://stackoverflow.com/questions/38487692/how-can-i-interpret-the-time-with-less-code/38492144#38492144 But I really want to keep Jonah's answer here too. Just ...
-1
votes
0answers
19 views

Using input from a prompt to loop through an array [on hold]

I'm trying to write a function for a card game which will allow players to exchange a card in their hand for a card in their opponents'. I'm just starting out, so I know I'm running into a problem ...
0
votes
0answers
14 views

display and calculate score for javascript quiz [migrated]

i'm a teacher and have just started learning to code for making online quizzes for my students. I'm still very new to programming like JavaScript and php, and I've tried to looked for sources online ...
2
votes
0answers
33 views

Input-reading library for Node.JS part 2

Note: This code is a rewrite of the post I mentioned here since according to CR policy I cannot update the same question. This is somewhat didn't went through that much thought process and I wrote ...
1
vote
0answers
67 views

“RESTful” node.js server using express

I have attempted to construct a simple RESTful node server that allows for user authentication using passport and jwt: ...
1
vote
0answers
28 views

Site Registration Code causing multiple accounts to be registered [on hold]

I have an app that uses the MEAN stack, recently I have seen a little strange behaviour. Now this doesn't happen every time a user registers, so far it has happened 3 times. When a user registers the ...
2
votes
0answers
72 views

Request Queue for League of Legends API

I am working on some website for League of Legends statistics, which uses the RiotGames API. The API allows you to do a maximum amount of requests per 10 seconds, and another maximum amount of ...
0
votes
0answers
66 views

Very basic React toDo-List

After learning a bit React in the last weeks I've decided to make a toDo-list. I've got the basic-functionalities (create, update, delete entries) finished. I'm going to enhance the app with a ...
1
vote
3answers
350 views

Bubble sort examination

I solved bubble sort in an exam, but the examiner wasn't satisfied with the solution. Please tell me why my solution is unsatisfactory. ...
2
votes
0answers
59 views

HTML5 Parallax Scrolling utility using canvas

I have created a utility to create scrolling parallax backgrounds. ...
0
votes
0answers
65 views

Saving an object using a promise chain

This here is some fairly simple functionality The user has a list of objects, which they modify, or may create a new object. When the user presses 'Save/Update' the 'saveClick()' function is called. ...
-1
votes
0answers
24 views

MySQL security in node.js client/server [on hold]

This is a little project I've been working on for a while, as I learn javascript, I believe I've got it to a good first version, but would like an opinion from someone who knows javascript more. ...
3
votes
1answer
109 views

HTML5 Snake Game

This is the first version of my first HTML5 game. Beyond the standard features, I've added a high scores board which uses local storage to keep track of the scores. You can move the snake with the ...
2
votes
2answers
54 views

Reading genetic data in VCF and Tabix formats using an asynchronous library

I'm working with an open-source library for processing and parsing genetic data in VCF and Tabix formats. It contains functions and classes that make it easy to read an index file (a Tabix) and load ...
3
votes
1answer
53 views

Input-reading library for Node.JS

Recently I have been busy with nodejs and I thought to create something like this Java input library, so I started with some rough code like below: ...
10
votes
3answers
800 views

Gallery of employees with dynamic filtering

I'm trying to learn how to write better, more efficient JavaScript code and wanted to run this function I'd written by you and see if people can suggest an improved method. It's basically a people ...
6
votes
1answer
101 views

Make Simultaneous HTTP Requests That Resolve Into a Single Return

This week, in an ongoing job search, I was tasked with the following pre-screening question: Make two simultaneous http requests. Use the language and library of your choice. Make sure the results ...
6
votes
3answers
209 views

Use functional-programming to convert a tree of parent:children objects to array

Having some trouble with a code I'm trying to refactor, where I need to go over a 'tree' of items, filter some invalid items, and create a new array of filtered items which takes properties from both ...
1
vote
1answer
48 views

Countdown module that hides an element when a specified date is reached

I have the following piece of code which hides an element when a specified date was reached. I would like to get some tips about do's and don'ts. Specifically, I'm interested in: improvements ...
8
votes
1answer
473 views

Bot for Spacewar PPCG KotH

I wrote a bot for a Programming Puzzles & Code Gold King of the Hill type of challenge called "Spacewar!". The challenge was written by @El'endiaStarman. The bot is called "Spy". The controller ...
0
votes
0answers
25 views

What do you think of this pattern to iterate over Objects and return a new Object? [closed]

This function merges multiple objects that only contain strings into one new object. If a key appears more than once it concatenates its values. The objects that the function has to handle store css-...
0
votes
0answers
11 views

How to abstract this functions in JS? [closed]

I'm trying to abstract this pack of functions basically into two (one that sets a value and one that pushes a value), but I'm kind of lost. I've been using de Revealing Module Pattern so this code is ...
3
votes
0answers
40 views

Linear finite state machine in ES6

I would love some feedback on my linear finite state machine. I say linear, as it can only handle one state at a time. I am also giving my method of how I -work- with the state machine, as I would ...
4
votes
2answers
62 views

jQuery functions to add corresponding entries of lists

Thanks to this post, I was able to create a working piece of javascript that fits my needs. I have a div/ul/li based table where each "row" has 2 values that I want to have the sum for. Currently the ...
0
votes
0answers
11 views

Complete Polymer element to invalidate fields based on server response

I wrote hot-form-validator, which is a super-simple widget that marks named fields as invalid depending on server response. I actually did the lot -- full documentation, tests, demos -- and they all ...
3
votes
0answers
27 views

Fade and slide animatable elements on window scroll

I wrote a simple JavaScript function to animate objects on my webpage to fade and slide in from the bottom of the screen when the user scrolls them into view. I did this by using JavaScript to add ...
-1
votes
0answers
6 views

Passing Code to updateButtonLabel for TIC TAC TOe [closed]

I am incredibly new to coding as well as this website. This works for the most part except for win functions toward the bottom. It is supposed to be a Tic Tac Toe game board and it needs to display an ...
3
votes
1answer
38 views

Use of scoped objects in a JavaScript Tic-tac-toe implementation

I have been using the w3 org's JavaScript Best Practices web page's examples for coding an object literal for a game. It is my understanding that I should use this to keep all my variables and arrays ...
4
votes
1answer
97 views

Automation project

There are buttons on a page, each corresponding to a different code that needs to be sent to PubNub DSN, which is published to my home server to operate specific on/off commands for various lights in ...
6
votes
2answers
159 views

Return the correct object type in Javascript

I am currently wondering if the following piece of Javascript code could be simplified? I would like to return the correct {},[],"" without having to pass a type as ...