All Questions
473 questions
7
votes
2
answers
258
views
eCommerce Mockup App in JS
I have completed this mockup eCommerce app using Javascript. This version can add products into a shopping cart and automatically calculate the order summary in the shopping cart. It can also delete ...
7
votes
2
answers
373
views
Iterate from "0" to "ZZZZZ"
I was given an assignment, it was as follows:
Give a JS code snippet which writes to the console from:
"0" to "ZZZZZ" all the combination of the characters of a-z, 0-9 and A-Z.
Is my solution ...
7
votes
1
answer
69
views
Catch-style unit testing in JavaScript (phase 1)
I decided to port my favorite unit testing framework, Catch, to JavaScript. So far I'm focusing on test cases and sections. I'll add assertions in phase 2, and output in phase 3.
The goal for this ...
7
votes
1
answer
2k
views
Using TinyMCE with responsive file manager PHP and Javascript
I use TinyMCE with responsivefilemanager and I wanted to know that is my code well-written maintainable and readable, Sorry If this sounds like a stupid and basic question because this is such a basic ...
7
votes
4
answers
781
views
HTML Editor - online HTML editor with real-time preview
Note
Please review the new question and ignore the following.
Overview
HTML Editor is an online HTML editor with a minimalist approach. Edit your HTML, CSS, and JavaScript code and monitor the ...
7
votes
2
answers
111
views
Simpler number theory game
After receiving some awesome feedback in my first post yesterday, I was able to grasp the "building block" method of creating javascript in chunks and putting them together to create coherent/...
7
votes
1
answer
205
views
Multiple inheritance pattern for vehicle information
I wanted an easy way to augment objects, by adding functionality from any other object(s). More importantly, I needed a way to augment the object from multiple sources in a clean one-line solution.
...
7
votes
1
answer
2k
views
Plugin that conditionally displays elements based on form values
I've just released a jQuery plugin that conditionally displays elements based on form values. I would appreciate any suggestions on how to improve both the code and its usefulness.
Here's the demo ...
7
votes
1
answer
17k
views
Checking for balanced brackets in JavaScript
I'm wrote a simple function isBalanced which takes some code and returns true if the brackets in the code are balanced and ...
6
votes
1
answer
765
views
Node.JS Automatic Poem Generator
As a simple programming exercise, I wrote a piece of Node.JS code which generates random poems. It is based on a list of articles (kind of), nouns, linking verbs, and adjectives. It then combines them ...
6
votes
1
answer
662
views
Canvas animation
Just started learning how to use the canvas today as I wanted to copy an animated GIF.
The GIF I tried to copy is below.
The animation does work but I've hacked it left and right. There's obviously ...
6
votes
3
answers
10k
views
Sudoku game in JavaScript
PHP coder here. Learning JavaScript this week. I made a sudoku game for practice. Features:
Import puzzles by pasting a text string.
Imported squares are gray. Your squares are white.
Program doesn't ...
6
votes
1
answer
1k
views
Count to target with JavaScript
I'm looking for (and be as brutal as you like) ways to improve the code or the algorithm (I'm aware there should be comments) - I'm a recreational programmer and would like to be improving my skills. ...
6
votes
2
answers
498
views
Relying on short-circuit evaluation instead of using the IF control structure [closed]
Examples of where I've started migrating to short-circuit evaluation:
PHP
...
6
votes
3
answers
6k
views
JavaScript text-based RPG
I'm making a text-based RPG in JavaScript. It works but I'd like to know how to improve it, like code-wise. Also, I want to know how to make it run on anything other than Internet Explorer.
...
6
votes
1
answer
4k
views
A simple MP3 player with React.js
I've been learning React.js for the last few days and am working on a simple MP3 player. I have a few years experience with JavaScript, however, I am just trying to get used to the idea of components ...
6
votes
1
answer
2k
views
Improvements to an Angular ScrollSpy module
Things that I'm not sure about:
Whether this works in all use cases - alongside routing and within templates etc
Am I polluting the scope with all these variables? This seems to be the easiest way to ...
6
votes
1
answer
697
views
JavaScript discrete slider web component
The standard HTML range input element suffers from a number of limitations that caused me to implement the web component presented here.
First, it is unnecessarily complicated to style the standard ...
6
votes
2
answers
254
views
Simplifying this form validation script
Can anyone please help me to simplify this form validation script? It works great but I was just wondering if I can get some help to make it simpler. Your opinion on the approach I used below is ...
6
votes
2
answers
3k
views
Hamming distance between numbers in JavaScript
In Leetcode it states that my runtime is only faster than 38% all of submitted JavaScript solutions. Is there anything I can change to make it more efficient?
...
6
votes
1
answer
804
views
Linear algebra, reduced row echelon form - function 1
This is a derivative post from here.
This is just a general review, so the question is the same:
Is there something...
That you would consider as a bad practice and why?
That is just bad in some ...
6
votes
4
answers
122
views
Simple number theory game, pt. 3
More refactoring based you guys' great feedback. This time around I worked on using global/local variables properly and efficiently, putting return values to use, renaming variables so that the code ...
6
votes
1
answer
799
views
JavaScript Breakout Game
I'm a novice programmer who is very new to JavaScript, and animation/graphics, and I have this breakout game on my flask website.
I tried to do as much as I could from scratch, and I'm unsure if my ...
6
votes
2
answers
125
views
Reformatting a structured string like "a-b-c|A-B-C" into "a-A|b-B|c-C"
The code below was inspired by this post in Code Review.
Here is how it was first intended by its author:
I have the following code that converts a string that looks like :
aaa-bbb|ccc-ddd|eee-fff
...
6
votes
1
answer
8k
views
Shopping Cart with React JS
I've just created my first set of related classes in React and would like to get feedback from more experienced React developers.
I've used ES and completely vanilla React. The application is a ...
6
votes
2
answers
570
views
Rock, Paper, Scissors, Lizard and Spock with OOP
Today I saw an extremely interesting question on the Rock, Paper, Scissors, Lizard and Spock game. I've decided to take my swing at it and I've written the following OOP implementation:
...
6
votes
1
answer
396
views
Javascript Canvas Game Engine
I am creating a simple 2D canvas game engine in JavaScript. Are there any optimizations that I could make, or obvious issues (performance, semantics or otherwise) that you can see?
JS Bin here
...
6
votes
2
answers
2k
views
Retirement Calculator
I created a program that determines how many years you have left before retiring, and in a year when you can retire.
This is my code below:
...
6
votes
3
answers
436
views
Class Activity Calculator
Introduction
Class Activity Calculator is an online application to calculate the students' class activity grades. The class activity grade (CA) is calculated based on the marks a student gets during ...
6
votes
2
answers
3k
views
Zip Code to City, State for registration form
Took me a couple of days (in between working on other projects) to get the code working, but now that I do have it working I would like to know if there is a way that I could make it work better, or ...
6
votes
1
answer
894
views
Shopping cart simulator
I have tried to simulate a cart (only partially completed). I just wanted to see how the code upto this point can be enhanced. I am trying to learn about the usage of ...
6
votes
1
answer
240
views
Work order spatial query (Part 1)
Part 1: General Cleanup
(Edit: Part 2 is here.)
I have a script in a Work Order Management System (Maximo) that performs a spatial query.
Details:
Takes the X&Y coordinates of a work order in ...
6
votes
2
answers
445
views
Selection Sort Algorithm (Node.js)
I wanted to implement a selection sort and wanted to make sure that I'm doing it correctly. I wanted to do it in a way that's efficient and use recursion. Please let me know if I am doing this ...
6
votes
3
answers
4k
views
Finding the given word from jumbled letters
I have tried to write JavaScript code to check whether I can form a word from the given string (jumbled):
...
6
votes
2
answers
2k
views
Cake-ordering form and calculator
I’m a designer learning to code and I’ve built a simple form calculator for ordering cakes.
I would love it if you could show me how to make the code more idiomatic. How can it be more consistent, ...
6
votes
1
answer
578
views
Resizable split DIVs Vue.js
I just started Developing Web App (Vue.js) for my company for around 1-2 months. Therefore, my knowledge and experience in HTML, CSS and Javascript is kinda shallow.
I've created a custom resizable ...
6
votes
1
answer
3k
views
Navigation bar built from fetched JSON data
I have finally been able to create my little navigation plugin in an object-oriented way that reads the li from a JSON file.
Now, is my code efficient? Especially, ...
6
votes
1
answer
200
views
3D 1st Person Snake Game #3
Final iteration of an iterative review.
The previous iteration is here: 3D 1st Person Snake Game #2
Note: For the snippet, click run, "Full page", purposely lose, and then type r.
Here is the ...
6
votes
3
answers
869
views
Flatten an array
I have got this interview question which has asked me to write a production level code which flattens the arbitrary nested array of arrays.
Code
...
6
votes
2
answers
128
views
Loop through string array with exit if test passed
I need to return True if a page contains any of a list of element types. This code works.
...
6
votes
2
answers
1k
views
My Google Maps Script
I've written a script with the Google Maps JavaScript API v3.
I've ran it through JSHint and everything seems to be valid.
I'm wondering if my script has room for improvement.
Any suggestions are ...
5
votes
1
answer
3k
views
Making sure a sentence exists of words in a dictionary
Today on Stack Overflow the following question came
https://stackoverflow.com/questions/39393112/find-out-if-string-contains-english-words-only
The question itself has following prerequisites:
A ...
5
votes
1
answer
67
views
Utilities for Various Builtins #2
This is the final iteration of an iterative review. The previous iteration can be found here: Utilities for various builtins #1
This code solves the following issue:
...
5
votes
1
answer
587
views
Quadratic Equation Solver v2.0 in Javascript using Functional Programming
I have posted this in continuation to my earlier post Quadratic equation solver in JavaScript.
Tried to improve on the shortcomings last time and also changed the logic. It is still not covering all ...
5
votes
2
answers
890
views
Uploading multiple files to server with PHP and JavaScript
I wrote some code to upload multiple files to a server with PHP and JavaScript. I'm happy with the form and JavaScript, below.
...
5
votes
2
answers
1k
views
Random tone generator using Web Audio API
This is a random frequency audio generator made with the Web Audio API by Mozilla. The end-goal is an audio frequency trainer: the website plays an audio frequency and the user tries to guess which ...
5
votes
1
answer
484
views
Doubly Linked List Javascript
A doubly linked list contains elements that include pointers to the previous and next element along with a value. This data structure is implemented with methods similar to what you would find in an ...
5
votes
2
answers
640
views
99 Bottles of Beer using polymorphism
This was part of an exercise from exercism.io. If you fancy, view the repo here.
Given problem statement:
Write a program which produces the lyrics to that beloved classic, that field-trip ...
5
votes
2
answers
5k
views
Simple math game in JavaScript
Created a simple math (addition/subtraction) game to practice my JavaScript. Any feedback on the JavaScript appreciated.
Can play in: CodePen
Instructions: A math equation will show up and simply ...
5
votes
1
answer
2k
views
Traversing the parent-child relationship between objects
I wrote this code because I was often annoyed that I couldn't get the parent object. This class allows you to traverse the parent-child relationship between objects, in both directions. It also ...