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

Filter by vendor-feature with jQuery & Isotope

Task description: A set of product-thumbnails is shown. The user can filter the shown products by vendor(s). Done by clicking one or multiple buttons. I used jQuery together with the Isotope-plugin: ...
0
votes
0answers
10 views

Project Euler #4 - finding the largest palindrome from the product of two n-digit numbers

The code works well enough until trying to find the largest palindrome of two eight digit numbers. I found a similar question in C++, but there are some differences: The main function takes two ...
-1
votes
0answers
12 views

Function that returns largest/smallest number from string [on hold]

The exercise I'm doing asks for a function that can take a string of numbers (separated by spaces) and return the highest and lowest numbers. My code is working great except it thinks that 542 < 6.....
-1
votes
0answers
8 views

A Simple AI Movement Program [on hold]

I am creating a movement program for an AI. However, whenever I check the console to check for errors, I get "Unable to define 'newPos' of undefined or null reference". I cannot figure out why it is ...
-1
votes
1answer
36 views

Sonar advises JavaScript function is too complex

I'm experienced with JavaScript, but new to refactoring. Sonar specified that the below function is too complex. I'm looking for suggestions on how to simplify it, mainly the conditional statements. ...
3
votes
1answer
49 views

Generic paging algorithm

I have made a simple pagination algorithm. It shows "next" and "previous" buttons when appropriate. It also limits the amount of buttons if the page amount exceeds a certain amount, e.g. ...
1
vote
2answers
69 views

Use jQuery to force two checkboxes mirror each other's state

RESTRICTION: jQuery 1.6.4 only, no other library, or version can be used. My goal is to use jQuery to allow two input checkboxes behave the same. For example: If 1st checkbox is checked, 2nd will be ...
1
vote
1answer
42 views

Load page content on hashchange

I want to create a modular website with no frameworks or CMS nor server-side language. Also, I am doing simple use of the hashchange event to help the navigation. The structure would be as follows: ...
0
votes
1answer
50 views

Fluent interface builder

I'm working on a fluent interface builder that takes: an array of strings, each of which becomes a key to an object that is a function that follows the fluent interface pattern a terminator function ...
1
vote
0answers
25 views

jQuery Plugin for a Form

jQuery plugin for a form. Looking for constructive criticism on my code. Thanks in advance! ...
-3
votes
0answers
23 views

Get button value to array [on hold]

I have 3 buttons with 3 different value. When i click buttons then all values insert to javascript array.How do I do like that? ...
0
votes
0answers
23 views

Is a reversed list bubble sort's worst case? [on hold]

Below is the bubble sort method. Sources tell me a reversed array would be the worst case for bubble sort. I run bubble sort on a) random array of size 10000 b) reversed array of size 10000 Why ...
3
votes
0answers
64 views

JSON Data Observer

I wrote a small piece of code for observing changes on JSON object. Whenever there is a change in Object, it should trigger all the handlers with simplistic information about data change. I am ...
0
votes
0answers
16 views

Using Async.js 'auto' method, checks two different databases/sources for matches, and manipulates the final results

Is there a way to abstract the final callback of the async.auto section of the testZip function below? My issues is that that I am repeating that section as the callback for a handful of other ...
1
vote
0answers
28 views
-2
votes
0answers
17 views

kendo ui grid : Couldn't populate data using angular js and asp.net web api [on hold]

I am using kendoUI's grid for displaying data. Well I am using angular js in front end and asp.net-core webapi and entity framework in server side. I made a call to the api. I am getting response from ...
3
votes
2answers
340 views

Empty block in recursion base case

I wrote a recursive function to uncheck all menu nodes. It works well, but I need to know if it is right to leave empty block inside ...
4
votes
1answer
66 views

Javascript equalise heights of groups of elements

This is a small function I have written to equalise the height of groups of elements. Useful for when titles or content will end up being odd length and throw out the visual flow. To use it you just ...
0
votes
1answer
41 views

JavaScript events architecture [closed]

I have made one architecture on my project and want to know. Is it good or bad? ...
0
votes
0answers
43 views

Stack which finds the minimum element

Write a program to implement stack which implements min a method which gives the minimum element below the top element in the stack. ...
0
votes
1answer
81 views

Using promise all with push array

The code's purpose is to call to some function async given some condition was true. I've using the following code which is working as expected. Is there a way to write it better, maybe by not using ...
2
votes
1answer
43 views

Tooltip-overlay following the mouse pointer

The purpose is to attach a tooltip-element to arbitrary HTML-elements. The tooltip appears when the user hovers an element. Follows the mouse-pointer while moving over the element. ...
2
votes
1answer
47 views

Client Side JavaScript [aka Greasemonkey] Key Event Handler

Description The code captures keypress events that do not occur in a text field and dispatches on the properties of a $command object in the application execution ...
3
votes
0answers
30 views

Gulpfile Optimizations

I'm looking for some advice in how well this gulp file is written out and any suggestions on improving it. Any insight is appreciated ...
2
votes
0answers
31 views

JavaScript breadth-first search algorithm

I have implemented a breadth-first search and I'm more or less looking for suggestions on how I can improve on what I've done here. How to use: ...
0
votes
0answers
32 views
5
votes
1answer
53 views

String checking functions in functional JavaScript

Please review these string checking functions. This is the whole module which is actually written here. It supports buffer, array...
0
votes
0answers
43 views

Hashing passwords with crypto in Node.js

Going through my old files today, I found this code which I wrote a year ago after being asked by my professor to create a "secure" encryption, decryption and password hashing functions. ...
-1
votes
0answers
16 views

Remove Animation and instead use buttons to skip through images [closed]

I had a developer build this for me ...
3
votes
1answer
43 views

Display captions based on video time

I need to display a "caption" from a video but I cannot use built in captions provided by a vtt file for my situation. I created an array that stores the key,value pair (time, caption). I traverse ...
0
votes
1answer
37 views
0
votes
0answers
38 views

Controller for CRUD operations on users

I am working on Angular JS project. Our project contains lot of controllers and each controller having more functions. Please refer below one sample controller which contains more than 6 sections. I ...
1
vote
1answer
40 views

Adding several text parts to one file in sequence

In my script, node.js reads text files and generates text itself. At the end, I have five "text parts", and want to add them to one file. For this step, it must be considered that the sequence is ...
9
votes
1answer
120 views

Table tennis exercise builder

I am trying to create a builder for table tennis exercises. User Blindman67 helped me here. Now I'm trying to clean up the code before continuing to work on it. Please tell me how to clean up the ...
2
votes
0answers
24 views

Google Maps API implementation with a revealing module pattern

What follows is the JavaScript written for a Google Maps API implementation (for an image gallery that shows image, location, description, next and prev buttons, etc.). I have a JSON "...
0
votes
1answer
33 views

Generate powerset in JS

I came across a mock interview question in which the candidate is asked to generate the powerset of a given set. The input set is represented as a unique array of integers. There was no solution ...
2
votes
1answer
30 views

'join' MongodDB collections with a for loop

This is a very simplified version of my query. Is it acceptable to join the two collections for the client with the use of for loops? There could be up to 2,000 books, which also means there could be ...
2
votes
2answers
65 views

Sort an array of name and ages in JavaScript

I'm doing this assignment were they have told me to sort an array of objects with name and age. What do you think about my solution? Edited to take in consideration comments, Thanks for the feedback ...
0
votes
1answer
35 views

Shrinking header on scroll

I have the following jQuery which applies a class to my fixed header to shrink it when the user is scrolled any distance down the page: ...
0
votes
1answer
56 views

Displaying quiz questions in a web app

I built this web app to present a random group of questions for quizzes and tests. The page opens with random questions. Clicking anywhere shows (only) the spinner div. Clicking anywhere again brings ...
2
votes
0answers
22 views

Dynamically displaying different controllers

I have here a simple webapp for displaying different D3 demonstrations: The idea is - the user can select one of many modules in the control bar at the top, and the corresponding controls for that ...
4
votes
1answer
51 views

jQuery for revealing secondary menu

Below is some jQuery I recently wrote and I'm quite sure there is a more elegant and/or efficient way to write it. The gist is, when a user clicks on a Primary Nav link, its Secondary menu slides down....
0
votes
1answer
28 views

Classifying top and bottom navigation links

The current code I have runs fine, but I'm curious about some other approaches to making this more DRY. ...
3
votes
1answer
34 views

Filling Array with Alphanumeric values

I've done a function that does the following : It takes an argument length that it will be the length of the result array. The Array should start with alphabet ...
1
vote
2answers
31 views

Finds a position to break a string that is not part of a <br>

I have a 'read more' angular directive copied from: https://github.com/doukasd/AngularJS-Components/blob/master/dd-text-collapse/dd-text-collapse.js Some of my text can already have ...
2
votes
1answer
56 views

A clock implemented using Moment.js

This is a POC for a clock using moment.js, eventually I plan to recreate this in Raect.js. Any opimisations or a better way to do it? ...
3
votes
1answer
52 views

jQuery menus, click handlers, and scroll effects for a website

So far, I've been using codes based on solutions other people wrote, and I'm trying to learn by modifying those codes. My problem now is that my code ended up too messy (a lot of script tags, jquery ...
1
vote
0answers
27 views

Node.js MySql code using Promise API

I have written a javascript code for fetching data from mysql database. I have used connection pooling, and Promise API also. the code is as follows, ...