Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [javascript]

ECMAScript or ES (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms as stand-alone interpreters or JIT compilers. Use this tag for questions regarding all versions of ES up to the current ES8 and its dialects / implementations: JavaScript, JScript, etc., excluding ActionScript.

37
votes
2answers
33k 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
63k 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 ...
9
votes
2answers
9k 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. ...
8
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 ...
5
votes
1answer
324 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 ...
5
votes
2answers
168 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 ...
22
votes
2answers
551 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 ...
5
votes
2answers
821 views

Matrix of articles and authors from large JSON dataset

Given the following JSON data containing 4 articles by 4 different authors: ...
24
votes
3answers
2k 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
257 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
473 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 ...
2
votes
1answer
136 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: ...
39
votes
5answers
20k 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 ...
26
votes
2answers
651 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 ...
10
votes
2answers
671 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 ...
5
votes
1answer
338 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 ...
22
votes
1answer
1k 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
303 views

Brainfuck Interpreter in JavaScript 3

I have this Brainfuck interpreter: ...
3
votes
5answers
3k 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 ...
12
votes
2answers
24k 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
314 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
1answer
187 views

Snake on a Plane

My code uses a canvas element to create a live snake game on a plane! ...
5
votes
1answer
122 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: ...
4
votes
1answer
79 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
101 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
158 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
358 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 ...
8
votes
2answers
238 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
266 views

Local user registration

More javascript (nodejs) to go with the passport wrapper I just posted: UserBook.js ...
6
votes
1answer
83 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 ...
4
votes
2answers
822 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
2answers
4k views

Codewars: Sum of Pairs

I've been working on this task (see screenshot). Here's my answer to it so far: ...
3
votes
1answer
661 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
2answers
2k 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 ...
3
votes
4answers
105 views

Computing the BMI

The is my code to compute BMI (body mass index). How can I make this code better? ...
2
votes
1answer
478 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 ...
2
votes
1answer
103 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
159 views

A package for sort algorithms - v2

Looking for general feedback and praise. This is for learning an not implementation as I would expect the built is sort algos to be much faster. Addressed issues here: A package for sort algorithms ...
1
vote
1answer
6k views

Wheel of Fortune game

The Demo for what I have made is located here: http://jsfiddle.net/maniator/H5LKy/181/ Basically I am trying to make a Wheel of Fortune type game. Is there anything I could improve on in the code? <...
1
vote
2answers
2k views

Wheel of Fortune game - follow-up

After posting this question I made some updates and changes to my code. My new demo for the game is located here. Right now it is only one player. Is there anything I could improve on in the code? <...
1
vote
1answer
140 views

JavaScript-based War card game - follow-up

Original Question I have updated my code based on feedback from other users and am submitting this question for re-evaluation. HTML ...
0
votes
1answer
53 views

Follow-up zp-Tree to represent Trees as nested arrays

This is a follow-up on my previous post. I have made modifications based on the feedback received on the previous post, hence I request another review on the modified code if ok. Note: review ...
0
votes
2answers
219 views

Write an anonymous function validating email address

Problem statement Write an anonymous function which take email address as parameter and returns true/false after validating the input parameter. Objective This assignment will help you ...
63
votes
9answers
96k views

Generating all combinations of an array

I'm generating all combinations of an array, so for instance, ["a", "b", "c", "d"] will generate: ...
51
votes
5answers
35k views

Verifying password strength using JavaScript

I have a function which verifies the "Password" field and suggests the user to enter a strong password. I also have a label named "Password Strength", referring to the strength of a password (very ...
23
votes
1answer
35k views

Handling Hover Events on a Touch Screen

A website I have designed uses a nav menu that shows submenus on :hover. The initial site did not use any responsive design: it targeted only the desktop ...
23
votes
3answers
134k views

Removing duplicates from an array quickly

...
16
votes
2answers
12k views

Faster JavaScript fuzzy string matching function?

I'm using the following function to fuzzy match strings: ...