Questions tagged [javascript]

JavaScript is primarily a language focused on web development. Being a monopoly on the front end and having Node on the back end. Use this tag for questions regarding vanilla JavaScript; optionally tagged with an ECMAScript version. If you are using a preprocessor such as TypeScript please tag with that too.

Filter by
Sorted by
Tagged with
42
votes
2answers
39k views

Balanced parentheses

Given an expression string exp, write a program to examine whether the pairs and the orders of "{","}","(",")","[","]" are correct in exp. For example,...
11
votes
4answers
65k views

Different way of writing multiple click functions

I have the following .click() functions: ...
12
votes
1answer
1k views

Responsive/adaptive website code

I have all these functions that work together to create functionality on a page. Is the structure of these functions OK? Can I do anything to speed this up or make my code better? I'm not exactly ...
10
votes
2answers
10k views

How can I quickly find unique list items?

I use the loop-every-single-list-item approach to filter out unique elements in a given list, which tends to be very inefficient way as a list grow in size, or as function call frequency increases. ...
9
votes
2answers
2k views

Enforcing set environment variables

Context I have a node.js application that uses many other modules and libraries. Some of these modules pull details from process environment variables, such as URL's for databases, credentials, and so ...
7
votes
2answers
185 views

Adding links to tags on StackExchange sites

This Greasemonkey script adds links to tags on StackExchange sites which allow for activating, deactivating and ignoring favorite and related tags by using UI components. Since JavaScript is not my ...
7
votes
1answer
333 views

MVC - Control Module - Version 2

All models are in the model namespace and follow a naming convention. This makes it easy to consolidate control into cType() as shown below. All control passes ...
25
votes
3answers
666 views

Code-Q2A - copy code blocks from questions to answers

I came up with an idea for a userscript to simplify writing answers on Stack Exchange while writing a previous answer. This userscript adds "Review"-links on the top of each code segment. When ...
6
votes
5answers
7k views

Validate that brackets are balanced

I've done a test for a job (which I failed) and I'd like to know in which ways my code could've been better. Here are the questions and my answers, it's not very long. 1) Make a program that ...
29
votes
2answers
757 views

Desktop Notifications for flags and queue items

After our recent election, I got elected as a moderator here on Code Review (Thank you, community members!). One of the first things I missed among the moderator tools was desktop notifications for ...
5
votes
2answers
879 views

Matrix of articles and authors from large JSON dataset

Given the following JSON data containing 4 articles by 4 different authors: ...
25
votes
3answers
3k views

Simple object-oriented calculator

After studying several ways of doing OOP in JavaScript I think I finally came up with one that seems OK to me. Is it okay? Do you see some problems I can face by using OOP in JavaScript like this? ...
6
votes
2answers
346 views

Simple object-oriented calculator - follow-up

This question is an improvement I did based on recommendations from this other question: Simple object-oriented calculator JSFiddle ...
11
votes
1answer
528 views

node.js passport wrapper

I have started some experiments with node.js. Any comment on style (especially the callbacks) and best practice is appreciated: PassportControl.js ...
3
votes
1answer
171 views

Simple HTML website with JavaScript navbar

The following code is a website with a nav-bar on it. It uses some simple JavaScript to make it work: index.html: ...
24
votes
7answers
9k views

FizzBuzz in Javascript

I'm sure everyone here knows what FizzBuzz is. I would like constructive criticism for my solution. I'm a beginner to programming as a whole and this isn't my first solution, but it's what I think is ...
43
votes
5answers
30k views

Determining if two words are anagrams

I was given a this problem at a technical interview and failed miserably in the time given. Afterwards, I sat down and worked out what I think is a good solution. The task was actually to build an ...
13
votes
2answers
173 views

Bookmarklet for selecting code snippets on Code Review

The following code will add to each code block a 'Select Code' button that will select the code belonging to that block. Please review for maintainability. In order to use this, visit http://...
12
votes
2answers
788 views

In-browser syntax highlighter

I've made a simple in-browser syntax highlighter using JQuery. It's pretty simple, it just wraps keywords, integers, and such in <span> elements with color ...
6
votes
1answer
382 views

JavaScript module to render and handle a form to add users

I recently switched to modular JavaScript and really like the idea of having the state of your application in JavaScript and not in the DOM. I want to know if what I am doing is considered best ...
23
votes
1answer
2k views

Brainfuck interpreter in JavaScript

Just what it says on the tin: a brainfuck interpreter in JavaScript. ...
15
votes
2answers
2k views

Markdown to HTML

...
6
votes
3answers
381 views

Brainfuck Interpreter in JavaScript 3

I have this Brainfuck interpreter: ...
12
votes
2answers
29k views

Changing Number to Words in JavaScript

One day I saw a question on Stack Overflow asking about changing numbers to words, I thought about it, and next day I started coding. When I had the code working, I thought it could, most likely, be ...
11
votes
1answer
262 views

Snake on a Plane

My code uses a canvas element to create a live snake game on a plane! ...
11
votes
1answer
380 views

Brainfuck interpreter in JavaScript, take 2

The previous version is here. This version takes suggestions from that review into account: brainfuck is now an object instead of a function, and ...
10
votes
2answers
196 views

Associating degrees with notes of scales

I have a JS file that creates an object with notes from a music scale when given a key (aka tonic/ note). The code works and does what I want it to do. I need a critique on the way it's written, what ...
9
votes
4answers
887 views

Simple Number to Words using a Single Loop String Triplets in JavaScript

I have extensively reviewed 2 old articles on the subject: https://stackoverflow.com/questions/14766951/convert-digits-into-words-with-javascript and https://stackoverflow.com/questions/5529934/...
5
votes
1answer
190 views

3D 1st Person Snake Game #2

This is an iterative review of this question: 3D 1st Person Snake Game #1 The next iteration can be found here: 3D 1st Person Snake Game #3 Here is a snippet of the code: ...
5
votes
2answers
136 views

Event emitter npm module

I was asked to complete the task described below: Event Emitters are objects that serve as the core building block in event-driven architectures. They simplify the process of handling asynchronous ...
4
votes
1answer
315 views

Determine whether any permutation of a string is a palindrome

The task: Given a string, determine whether any permutation of it is a palindrome. For example, "carrace" should return true, since it can be rearranged ...
3
votes
2answers
439 views

Find the elements that appear only once

The task: Given an array of integers in which two elements appear exactly once and all other elements appear exactly twice, find the two elements that appear only once. For example, given ...
3
votes
1answer
227 views

Simple object-oriented calculator - part 3

This question is an improvement I did based on recommendations from these other questions: Simple object-oriented calculator Simple object-oriented calculator - follow-up To those looking this ...
1
vote
1answer
359 views

Adding, deleting elements as per autocomplete results

I am working on a bookmarker project for replacing storage of bookmarks in a web browser. It will be storing bookmarks as per categories in a database. I have written some jQuery for the WIP search ...
1
vote
2answers
58 views

Dijktra's Algorithm Visualizer

A couple months ago I made an interactive dijktra visualizer that allowed the user to setup the map nodes and run the algorithm. I thought it was a good way to solidify my algorithm and html/css ...
8
votes
2answers
281 views

Desktop notifications for queue items

I wasn't satisfied with Simon's alert on the orange alert. I wanted to know if even 1 review item was available, so I made some modifications to the userscript so that it runs on the Review page, and ...
8
votes
2answers
292 views

Local user registration

More javascript (nodejs) to go with the passport wrapper I just posted: UserBook.js ...
7
votes
2answers
14k views

Getting all divisors from an integer

I am using mod and my code works. I am wondering if there is a more efficient way to write a method that returns the total number of divisors for an integer. ...
6
votes
1answer
92 views

Desktop Notifications for Queue Items - Updated Code

A while ago I took one of @Simon's scripts and updated it to make it more geared towards normal users (no offense mods) and this Question was created. But the link to the Github is no longer correct ...
5
votes
4answers
408 views

Calculate Final Grade: follow-up

I'm creating an online calculator to get the average grade of different tests my students take and also the final grade. I wonder if you see any problems in this update or any way to improve it: <...
4
votes
2answers
6k views

Codewars: Sum of Pairs

I've been working on this task (see screenshot). Here's my answer to it so far: ...
4
votes
2answers
1k views

Wrath Cookie Switch for Auto Golden Cookie Clicker

Sometimes you feel like a wrath cookie and sometimes you don't. Here is a function that I created that will run on an interval, so all I have to do is set a boolean when I want to switch between ...
3
votes
1answer
108 views

Login Server with Node.js

I'm currently learning Node.js. To practice, I've decided to create a login server. The program goes as follows: User connects to local website (10.0.0.79, props to this users answer for helping me ...
3
votes
1answer
970 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 ...
3
votes
1answer
126 views

Contact form with spam-prevention

Idea After a handfull of small javascript-projects, I also wanted to work a bit with php now. I decided to create a simple contact-form. Of course, I wanted it to be as spam-save as possible, so I ...
3
votes
1answer
47 views

HTML5 Tile Cycle Puzzle

It's been a while since I did anything with JavaScript. I made a tile puzzle game to help me brush up. You can find it here: https://compucademy.net/tile-puzzle/ I would like some feedback on my use ...
3
votes
2answers
4k views

Javascript based War card game

I'm working on a game of War for a potential employer and I was hoping someone could review my code and provide feedback on my code. HTML/CSS ...
2
votes
1answer
106 views

Adding, deleting elements as per autocomplete results - updated

I am working on a Python/Django project which has turned into a JavaScript/jQuery project due to the amount of asynchronous functionality that I thought to add. There is a JavaScript file which is ...
2
votes
2answers
69 views

Dim Hero & Add Background to Nav on scroll

I have followed a tutorial that initially was for adding a 'sticky' nav. I adapted this slightly so it adds a background to the Nav when the page scroll reaches the top-third point of the hero area. ...
2
votes
1answer
1k views

Javascript based War card game - final

This will be my last submission of this project for review as it's being submitted this evening. I have updated my code based on feedback from other users. I would appreciate any and all feedback ...

1
2 3 4 5
10