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

JavaScript News Ticker in Retro Style

I have chosen to do it in a some "Retro-Style". So that it shall remind one of old green-screen monitors. Version with working Ajax-Request and Sass-Code on Codepen : ...
-1
votes
0answers
6 views

Check digits-validating customer Id javascript [on hold]

ID must be 5digits in length for eg:77721 And it's sum digits 1,2,3. Eg :7+7+7=21 Sum must be equal the number represented by digits 4 and 5. Eg : 66618 is valid ,.12345 is not valid How ...
4
votes
1answer
21 views

Javascript promises, multiple api calls in then()

This is the first time I'm trying to use promises in JavaScript so I'm not sure if I have done it correctly but it seems to work. The problem is that I have ended up with a "nested when" and it ...
2
votes
1answer
8 views

Simple JavaScript Module “Loader”

I have written a simple JS module "loader" (loader is in quotes because it doesn't actually load the files) that is designed to resolve simple dependencies between modules. It is heavily inspired by ...
-2
votes
0answers
23 views

My code is repetitive, can someone give me a hint on how to make it more brief? [on hold]

This is what I have tried so far: codepen.io/alehl/pen/GqRqZv but I am missing something. I've been staring at it all day without being able to figure out what's missing.
1
vote
0answers
8 views

FlowRouter auto-redirect on login page

The site should be accessible only to signed-in users. I'm making sure I publish and enable data manipulation to only those, but I wanna make sure even the app structure won't be visible. What I did ...
1
vote
1answer
21 views

Object key diff

I've been tasked with finding property differences in massive JSON structures and return them in a particular fashion ([key_1.key_2, key_1, etc]). Here's my code, which is focused on readability so ...
1
vote
0answers
20 views

Shortcode parser in Javascript

I've written a naive shortcode parser in JS that parses shortcodes akin to those found in Wordpress. The intention is for this to be used in realtime on the client in order to preview edits on the ...
1
vote
0answers
9 views

Modular widget that minimizes js and css scope pollution

So, my goal with this is to create a simple login widget that does as close to nothing to the global scope as possible. The login mechanism is less important than the encapsulation. The whole script ...
1
vote
1answer
27 views

Building a 2D array “month view” for a given date

I am working on a calendar widget for a project. For any given date, I need to build a 2D array representing the "Month" that the date falls in, where the rows represent weeks in the month and the ...
-3
votes
1answer
40 views

Simple code refactoring in javascript

This code is working but there's a lot of duplication, how can I refactor it ? ...
1
vote
0answers
28 views

Counting and listing words in a table

I have recently carried out a test for university where I was given the following instructions: Write a simple JavaScript application that reads paragraphs of text input by the user and creates ...
2
votes
1answer
58 views

Algorithm for Tic Tac Toe

Currently, I am using an algorithm that finds the best move based on the existing states of the board. Is there a better way to do it? Is there a data structure that I can use? I have also considered ...
1
vote
1answer
30 views

Parallax animation running well on Chrome but slow on Safari

This is the continuation of a previous question I posted here. I've improved (at least I think so) the initial script from the previous question, now storing the data in an array, it runs slightly ...
2
votes
1answer
58 views

Validate a form using jQuery

I am validating a form using jQuery. It is working perfectly, but I just feel the code is quite "bulky". There is a lot of if statements being used to achieve ...
1
vote
0answers
14 views

Use of Module Design Pattern in simple D3 “overlay” program

I have been learning JS (mostly using D3) and I wanted to put the Module Design Pattern to use. I wrote a simple script that lets you build a bar chart with more ease / readable code. The end user ...
-3
votes
0answers
39 views

FizzBuzz Javascript Help Required [on hold]

Create a function fizzBuzz to return 'Fizz', 'Buzz', 'FizzBuzz', or the argument it receives, all depending on the argument of the function, a number that is divisible by, 3, 5, or both 3 and 5, ...
-5
votes
0answers
24 views

Object doesn't transfering into function. Uncaught TypeError: Cannot read property 'call' of undefined [on hold]

I need to check animal type without using operator "instanceOf". I decided to use variable animalType, and compare it with different values. But when I'm trying to run my application, I receive ...
2
votes
2answers
46 views

Show and Hide group of classes based on data attributes

Somebody please verify this code. Is this efficient? please tell me modular way to accomplish this task. Updated I want to add show class to ...
3
votes
0answers
17 views

Cyclic “dependency detection” in JavaScript

I have written some simple code to detect cyclic dependencies for a module loading system and I'd like some feedback on how I can go about improving it. The code itself finds the first cycle in the ...
1
vote
1answer
13 views

Optionally creating a directory path based based on existence in NodeJS

I've been doing some reading and tutorials. As such I've contrived a node based project to apply what I've learned. I thought this was a good example as it had some conditional async calls and error ...
1
vote
0answers
12 views

es6 OOP class Email + Facebook login

I've been given the task to create a micro-service which basically logs in OR creates a user. I chose to do this with express.js ...
3
votes
0answers
17 views

Menu of triggers reveal corresponding dialog elements

So I have this code that for the most part, does what it needs to do, but I'm having trouble making it more concise and elegant. Codepen Intended functionality: If you click a trigger, it's ...
-2
votes
0answers
18 views

Spelling bee wep app crashes mobiles, glitches on IE, perfect anywhere else [on hold]

Roughly one month ago I started teaching myself. I decided to make a spelling bee website for the language school I teach English at. This is the github project: ...
1
vote
1answer
34 views

`new Function` for json reference

I have JSON with references to other parts in that JSON file. ...
5
votes
1answer
79 views

Parallax animation, running well on Chrome but slow on Safari

I have the following script to create a parallax effect on the page using request animation frame, it runs well on Chrome, but on Safari is lagging, I think because I run too many calculations on each ...
1
vote
1answer
44 views

Colleague reassigning 'this' in TypeScript [on hold]

I've recently been working with TypeScript for new projects; one of my colleagues keeps reassigning 'this' to a local variable (usually 'that') in functions - is this pointless in TS as it's not being ...
5
votes
1answer
28 views

pluralizer.js - return plural version of item if qty > 1

I'm looking for optimizations and/or improvements. The code's flagship method read takes qty,item in the form of an array of arrays. ...
0
votes
1answer
33 views

Backbone view that “starts” the application

I use the the View below to get things started. I'm not interested in Marionette. This code is what is constructed when the application first loads. It in turn loads the composite view which is ...
3
votes
2answers
64 views

My JavaScript calculator

I am playing a bit with vanilla JavaScript and created a simple JavaScript calculator using eval(). Any suggestions for improvements? ...
3
votes
1answer
29 views

Google Maps geocoding lookup function

In an effort to keep all of the Google Maps Javascript API in it's own little world, I have created a googleMaps object that will contain all of the functions that directly make google maps webservice ...
0
votes
1answer
8 views

JavaScript 2D Grid Wrapper

I have written a simple wrapper for a 2D grid in JavaScript that allows me to resize the grid dynamically and I'd like to know if there's any way I can improve on my code. Here is the code itself: ...
1
vote
2answers
17 views

JS namespacing code

I have written a wrapper for my code that allows basic namespacing and I'd like some feedback on how it can be improved. It is designed so that a module can define it's namespace and get access to ...
1
vote
1answer
33 views

Support multi functionality in server.js

i've node app that having the main function server.js(entry point) Following is the server.js file code ...
1
vote
0answers
39 views

Dynamically call a function in a given module

I use the following code that is working as expected and I want to get some feedback from the community how I can Improve it... The code does the following: Get Some request with specific ...
4
votes
0answers
33 views

Developer-tool: Creates large arrays with random-strings for testing-purposes

I've made this developer-tool for my own use. Perhaps for colleagues too. Currently I'm thinking about enhancing it. So that different data-types could be chosen. But before that I like it to be ...
1
vote
0answers
15 views

Select the correct input when using input group after pressing a button

Introduction: I'm creating a form using bootstrap and I have different input groups with the same structure and functionality. All of them have a '-' button on the left and a '+' button on the right ...
6
votes
2answers
244 views

Card-fighting game Part 2

Information: This is part 2 of the game I am building. After some good feedback on my first post I decided it was time to post my updated code. The differences in this part are: Updated code after ...
2
votes
1answer
62 views

Graphic Ape Designs gallery website

I am currently working on my YR9 (I'm 14) IST web development project and I want to know some tricks for optimizing my website. I know that I shouldn't have the same CSS rules in the style tag on ...
-1
votes
0answers
13 views

Structuring JavaScript namespaces with closures [closed]

I have this JavaScript code, I would like to know if this is a good practice or not: ...
0
votes
1answer
31 views

Condense JSON for bandwidth efficiency

JSON is quickly becoming the formatting standard of choice for quick, convenient, and reliable machine to machine communications. It is flexible and widely supported but it has some drawbacks when it ...
0
votes
0answers
16 views

Merging JSON objects

I have 2 JSON structures. Input: ...
3
votes
1answer
56 views

childrenCount function in old and functional styles

I'm trying to transition myself from my old coding-style (if-else, for.. in) to functional programming. I've tried to update the ...
2
votes
2answers
77 views

Responsive horizontal scroll on mouse position

I am making a responsive horizontal scroll UI. The horizontal scroll position is calculated according to the mouse horizontal position: ...
3
votes
0answers
29 views

JavaScript Audio Player

Looking for feedback on any bad practices and general advice on how I might better structure my code. ...
-2
votes
0answers
14 views

Delaying Jquery CSS Animation using mousemove [closed]

I've been trying to put 10 seconds delay on this jquery css animation which is dependent on mousemove. I've tried unsuccesfully utilizing both .delay and .setInterval right before like so: ...
8
votes
2answers
126 views

Pokemon game in JavaScript

I'm practicing my JavaScript skills by trying to create a Pokemon game. So far, I've made the dataset and the functions required to work the game. Can someone help me optimize the code and tell me why ...
10
votes
1answer
148 views

Card-fighting game

I am currently building my first game/app in javascript. It is a very simple script that has about 130~ lines of code. I feel like what I did so far is not optimized, can anyone please help me ...
4
votes
1answer
46 views

JavaScript Blackjack

I am currently learning JavaScript and the project I have been working on is creating a basic Blackjack game. Some code was provided for me, with the additional instructions: "How would you edit the ...
-5
votes
0answers
23 views

Why won't my code work on Codeacademy? (javascript) [closed]

Objective: Write a function called perimeterBox that returns the perimeter of a rectangle. It should have two parameters. One formula for perimeter is length + ...