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

0
votes
0answers
14 views

Why the code works with or without THIS in React [on hold]

I have this code and it's interesting for me why it's working fine with/without this: ...
1
vote
1answer
22 views

Currency converter using angular.js

This is my first angular application. I am sure there must be many mistakes like coding conventions, naming conventions or implementation mistakes like what goes where. Could you please review this ...
1
vote
1answer
17 views

Building a SharePoint Search URL

I'm trying to build a URL to call the SharePoint Search REST API in TypeScript. The interesting part is building the querytext, which is done by my buildQueryText method. In my case it takes two ...
1
vote
0answers
20 views

A simple drag and draw HTML5 canvas

I've written a quick directive that provides two features: Clicking on an empty area of the canvas will allow a 'drag and draw' function Clicking on a an existing rectangle on the canvas will allow ...
-4
votes
0answers
16 views
-2
votes
0answers
25 views
-1
votes
3answers
44 views

Performance/cleanliness of if else statement in for loop [on hold]

I am looping through an array and want to do something different on the last iteration. Currently, I have: ...
1
vote
1answer
42 views

JavaScript function for the get a specifed weekday n-weeks before / in the future

I'm currently working on a intranet application. It shall have a GUI on which you can choose a weekday and a positive / negative integer. The integer stands for weeks. So let's say someone chooses ...
-4
votes
0answers
29 views

Modern BIOS and Modern OS, what think about? [on hold]

I'm developing two major open-source projects and looking for opinions. More information in this quick note and in their respective repositories of projects: ...
5
votes
1answer
39 views

Animation Template Method for Snake Game

I have recently finished my first iteration of a template method implementation for a JavaScript canvas animation of the snake game. However, I would love for the community to critique this code and ...
9
votes
1answer
61 views

Highlight specific words in a sentence with diacritrics

I am searching for some improvements, particularly in the regex, in the way I highlight specific words in a string. I have keywords into my database stored without any diacritrics The user comes ...
1
vote
2answers
33 views

Fetching data from nested JSON using jQuery and displaying in table

I'm displaying JSON data in a tabular format on a html page using jQuery. In the function I'm looping the resp.DATA once to get the key names so it can be ...
1
vote
1answer
58 views

Javascript startsWith prototype

I'm a Java guy in a JavaScript world, and I'm used to certain things about Java Strings that just aren't there for in JavaScript. Some of this I can accept, for example Strings are freaking everywhere ...
1
vote
0answers
27 views

Large table updates using AJAX in Internet Explorer 11 (Cont'd)

Previous topic: Large table updates using AJAX in Internet Explorer 11 For the functions included here, I have taken the advice of the previous answer and incorporated it in the restructure, but am ...
-1
votes
0answers
118 views

Express.js production deployment

I am running an Ubuntu EC2 where I am using Nginx to proxy all port 80 requests to the socket that my Node.js app is listening on. To start my app, I am using PM2. When I wrote the server for my app, ...
1
vote
1answer
29 views

Making a conditionally visible page-up button

I wanted to make a button that goes to the top of the page but only appears when you're not at the top. There are probably libraries that already do this, but I wanted to make it myself and after some ...
0
votes
0answers
39 views

Class for easier localStorage use

As simple as the title, the following code is just a simple class for ease of use with localStorage. I'm just looking for recommendations in clean up, ideas of things to ad, constructive criticisms ...
0
votes
1answer
11 views

Extracting values from refs pointing to form inputs

I have a form component with multiple refs pointing to form inputs. On submit, those inputs' values need to be passed the into form callback, structured as an object. Currently, it's achieved like ...
3
votes
2answers
63 views

Large table updates using AJAX in Internet Explorer 11

I have a website which only needs to support IE11. It is a single page application, which has about 200 table rows and each table row has 5 child rows. There is a pulsing function that updates the ...
-1
votes
0answers
18 views

optimize individual field return in jquery [on hold]

I have many input fields and I am not using form. This is my JS: ...
1
vote
1answer
38 views

Stopping Google from tracking Search results

I've created a brief UserScript (GitHub repository) for TamperMonkey to stop Google from hijacking Search results URLs for tracking purposes when you click them: ...
2
votes
0answers
74 views

Bill has a hard time keeping all his promises

Description A couple days ago I created this Angular 1.x provider for my Ionic/Cordova app. I'm using webpack and babel-loader for ES6/ES2015 syntax and modules. All my provider does is "provide" an ...
-1
votes
0answers
27 views

Yes/no output using AngularJS

I get data from a database which I dont have access to modify. I display that data in my AngularJS project. A part of data is equipment of a property: if the eq1 ...
2
votes
0answers
36 views

Knowledge base app using MEAN stack

I've been working on an app based on the MEAN Framework. I have got the app working but I just wasnt sure whether my coding structure and standard was good enough, meaning does it adhere to the ...
4
votes
1answer
26 views

JavaScript (ES7) LOC counter

I've been writing JavaScript for a couple years but nobody's ever really looked at my code. This is a small library I wrote to check code modularity, w/ input like ...
0
votes
0answers
19 views

Bluebird promises: generalized retry logic with timeout

I'm attempting to write an idiomatic utility that uses bluebird promises to retry asynchronous logic until it is successful, or until a set timeout expires. Currently I'm looking at: ...
0
votes
0answers
21 views

Get top of request given the file exists in Node.js application

The user can specify which source to get the list, if the file is not found then Boom returns 404. After that, the found source will fetch the top list and append ...
2
votes
1answer
61 views

Generating calendar months for a datepicker

I got a problem I'm finding pretty hard to solve. I'm trying to generate calendar months for a datepicker but at only 12 months I see a perf of around ~4-7ms. This doesn't sound like a problem but it ...
2
votes
1answer
53 views

Print HTML tables with information from some devices

I'm not sure if this is the right question but didn't come up with something else. I have this huge for{} loop which prints out some HTML Tables with some infos ...
1
vote
0answers
32 views

Reading content of directory for each HTTP request

I have a piece of code written in node and I wanted to know if I am in the right direction. Basically I have a site where the homepage lists 6 vehicle cards. Every time the page is requested I do the ...
0
votes
0answers
47 views

Calculator in Node.JS

I'm new to parsing, and there's only one way to learn anything, and that's to do it yourself. So I did. I wrote what is essentially a calculator. But instead you will send it a string and it will be ...
3
votes
1answer
47 views

JavaScript Script/CSS Loader Plugin

I wrote a basic JavaScript plugin that allows you to specify what specific JavaScript files and CSS files to be loaded in, and in addition specify attributes for each file. To specify where to load ...
3
votes
2answers
36 views

Changing images when hovering over links

I wrote a script to change a static image by hovering over navigation links. It works great, however, the script is very long and I'm guessing there is a much more efficient way to write this code. ...
-2
votes
0answers
39 views

“Cows and Bulls” game

We are working on an assignment where we have to generate code that will play player one in the game Cows and Bulls. I am working on a function that generates the code based on the values for ...
0
votes
0answers
36 views

Looping over text boxes and editing values

I wrote this code to check if a text box is empty. If it is I put the current date into it with a score and loop over the six boxes. Once it fills the boxes it will then loop over checking the dates ...
5
votes
1answer
85 views

Is date 18+ years old?

Considering that: the passed parameters are all numbers the passed date is a valid date It should return: true if the date is 18 or more years old ...
0
votes
1answer
28 views

ES6 block-scope variable usage

I am experimenting with ES6 using BabelJS in a codepen project you can find here. I am confused as to why my code breaks when I decide to use let instead of ...
1
vote
1answer
64 views

Keep div fixed when it is inside it's container on scroll

The required behaviour is : The yellow span must be positioned relatively to viewport (position:fixed;) when it is inside the pink div. The height of yellow span ...
0
votes
1answer
36 views

Four jQuery date time pickers

I'm using the Jquery date time picker link here In the four methods below I am initializing the DT pickers but they are all pretty similar except for the ID in the ...
3
votes
4answers
197 views

Color swatch selector with multiple mouseover and mouseout functions

I am working on a simple mouseout and mouseover functions. Basically, I have color boxes (or swatches) and I have to get the color of the specific box when hovered and when selected. You can see how ...
3
votes
1answer
46 views

Small HTML / JS drum machine

This is just a simple little drum machine. Since it loads sounds files, I can't just put it on JSFiddle. I tried Github pages too, but am not sure how to get the sound files working. However, you can ...
1
vote
1answer
47 views

Update / save / display values in a table

I am relatively new to Angular and need to put together an application to update / save / display values. The code is working, but I wanted your input the make sure that I am doing this 'the angular ...
5
votes
2answers
25 views

Optimize Game of Life

I'm a beginner at coding and the past days I tried to write the famous "Conway's Game of Life" in Angular.js. Right now I'm done with the code and the game works. But if the size of the playground ...
-2
votes
2answers
55 views

Recursive function in JS

EDIT: The code i provide includes a asynchron task in each interation, therefor i need the recursive function, my question is how to beautify the code and apply the proper use. I want to: Remove ...
1
vote
1answer
74 views

JavaScript Snake game

I recently followed a tutorial on a JavaScript snake game. I tried to improve that game by adding bad fruit which will make your snakes tail incredibly long. ...
3
votes
1answer
47 views

Shorthand JS library, take 2

Based on the feedback and suggestions I received in my previous post (Lightweight shorthand JS library), I've updated and optimized Mozart JS. Again, the goal is to have some jQuery-like ...
0
votes
1answer
55 views

Using basic REST API in Angular 1.x

I have built real-time markdown editor in order to learn AngularJS by practice. I think what I'm trying to do can be done a better way. Any suggestions appreciated. Here's my code: ...
2
votes
2answers
224 views

jQuery fade in and out with multiple objects

This set of code is very large, and I'm hoping if someone could show me a more efficient way of doing this. In particular, the JavaScript code, but HTML and CSS corrections are just as welcome. ...
1
vote
1answer
31 views

jQuery - Repeating same actions on different DOM elements

I feel like I’m violating a lot of DRY rules here but can’t think of a better way to do this. I have two event methods (there are actually four total just showing two) that are doing a lot of similar ...
-6
votes
1answer
74 views

Is my JavaScript code bad to JavaScript/CPU performance? [closed]

I'm very worried about memory usage in JavaScript. I don't have troubles with what I do, but I'm not sure if I did something as well :/ ! Most of the functions are for looping arrays (I stopped using ...