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.

7
votes
0answers
4k views

React Native - Rendering different scenes based on application state

I am using react-native-router-flux to organize the routes for my application. Using Firebase, I am able to call ...
6
votes
0answers
46 views

Todo list using pure JavaScript

I watched a YouTube video and completed the Todo List using Pure JavaScript. Below is the code I wrote. I want to improve this code, but it 's not clear how. I want to change this code to ...
6
votes
0answers
216 views

PEG.js grammar for a simple programming language

I'm trying my hand at developing a compiler and have written a PEG.js grammar for a simple programming language. A sneak peak at the grammar: ...
5
votes
0answers
71 views

NodeJs crawler for recipes

Here is my try on a crawler made in nodeJs with cheerio, I made it with the idea in mind to use it in a future project I wanna make. Here is the git link: https://github.com/Just4lol/CookCrawler If ...
5
votes
0answers
186 views

Spacial hashing Library

Old code ...
5
votes
0answers
167 views

Object-Oriented Sorting Algorithms

I would like a review of a library I've recently published. I realize this is a rather large request, but having looked on meta, it seems this is perfectly on-topic. I'll include a few choice samples ...
5
votes
0answers
308 views

Object-oriented fractal tree

I made an object oriented fractal tree in javascript using the p5 library, it consists of three files: Fraternal Tree.js branch.js flower.js Here is the github repo with the source code. All the ...
5
votes
0answers
145 views

Parsing BibTeX in JavaScript

I have a project for which I need to parse BibTeX strings. In v0.2.9 and before, I used Regex, and I want to change that. I set up a while loop system that reads ...
5
votes
0answers
73 views

Using components instead controllers in EmberJS v2

I am beginner in EmberJS. I have made todomvc for ember v2 for learning Ember. My implementation works without controller. I use components instead controllers. In the documentation I see: ...
5
votes
0answers
672 views

Datepickers for departure and return dates

I have to two datepickers. I want achieve a following functionality: when return date cannot be selected before departure and departure cannot be after return date. Mainly I am interested in ...
5
votes
0answers
973 views

Mocking the file system within a test

I've been using this method to test file-system functions as an alternative to mock-fs due to its lack of symlink support. I'd love to hear what others think and ...
5
votes
0answers
673 views

Exiting a Promise early

I'm using a Promise chain to write some data to a file, execute a command on it, inspect its results, and send the results, using Express.js. The thing about my function is that I need to be able to ...
4
votes
0answers
17 views

Tetris Game Javascript

I am creating Tetris in javascript. I have finished the basic mechanics. I would appreciate some feedback on how I could improve it. Down, left, and right arrow keys move the piece while the up arrow ...
4
votes
0answers
18 views

Merging client names into orders using RxJS

I have an API which I can't modify. I have to use data as it is. I want to join data from two separate requests where the second request is based on data from the first one. I have a working ...
4
votes
0answers
38 views

Given a string containing just parentheses, determine if the input string is valid

The task is taken from leetcode Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: ...
4
votes
0answers
47 views

<select multiple> with dropdown

I wanted to use <select multiple> but was annoyed by the poor design on desktops which is why I created a version with dropdown: ...
4
votes
0answers
33 views

Chess AI Using Minimax and Alpha-Beta Pruning

I am working on a Chess AI using chess.js, and currently, it can run 3 layers in under 10 seconds, but 4 or more takes minutes. How can I optimize my current code to be able to run 4 or 5 layers, or ...
4
votes
0answers
22 views

Get current user middleware from JWT using express

I'm using Sequelize and Google oAuth for authentication, I want to create a middleware that Verifies the sent token passed in the headers matches the one the user was initially signed to. Finds the ...
4
votes
0answers
65 views

Ship placement verification function for Battleship game

I wrote server-side Battleship game simulator in nodeJs/Javascript: A random player who begins is chosen. Both place their ships. Software recognizes if they are placed correctly. One of the players ...
4
votes
0answers
100 views

Two player snake game

I created a 2 player Snake game from my original one player version. I am looking for some feedback on how I made it. I think I could use improvement when handling input (...
4
votes
0answers
69 views

JavaScript canvas Snake game

This is my 3rd JavaScript canvas game. It's basically just snake right now but I am planning on adding some more aspects to it soon. I was wondering if I could get some feedback especially on how I'm ...
4
votes
0answers
43 views

Tweaking this Pong Game to embed a smarter AI

I am new to game development and took on the task to create a Pong replica due to my curiosity and interest in the field. I decided to write it in JavaScript because the game is not too labor ...
4
votes
0answers
169 views

Simple color clicker game

My friend recently made a color clicker game, and I tried cleaning up the code a bit. I want to know how I can improve the functions and passing/editing of global variables. There are a lot of ...
4
votes
0answers
31 views

Parsing root-level elements out of HTML fragment file

I have the following code written in NodeJS, using the parse5 library. It's purpose is to parse out the root-level elements in a file containing HTML fragments (Vue ...
4
votes
0answers
51 views

Node secure randomness implementations

I'm trying to generate secure randomness in Node as a personal challenge. I was wondering if the following implementations are correctly random or they have some flaws. ...
4
votes
0answers
77 views

UI testing for a web application, with variant scenarios

I'm pretty new to software testing and am currently working on a cloud-based web application. Briefly, the application uses: Ext JS as a framework Bryntum's Siesta framework for testing Currently, ...
4
votes
0answers
92 views

First Javascript program - Snakes game on HTML canvas

I'm relatively new to programming but my most familiar languages are Java, C# and Haskell and this is my first javascript program. All the concepts used in here were just the first thing that came to ...
4
votes
0answers
92 views

Advent of Code 2017 Day 3 (part 1) in Functional Programming (FP)

I wanted to practice functional programming (FP) without using any library but using vanilla JS only. So I took a problem from Advent of Code. https://adventofcode.com/2017/day/3 You come across ...
4
votes
0answers
141 views

React.js defaultMemoize as container

this is the code I wrote ...
4
votes
0answers
62 views

Controlling Finances with Web Development

Purpose First, let me explain the title: I previously had managed my finances like an old fashioned company might, and it worked wonders for making financial decisions (at least for me). I wanted my ...
4
votes
0answers
506 views

Generating Bitly links in a Google Sheet

I have this set of functions in my Google Sheet to create a Bitly bitlink whenever data in a row is changed. While this does work, it seems really slow to me. Looking at the Execution transcript, it ...
4
votes
0answers
286 views

Dungeon crawler map using JavaScript

I finally made a "full dungeon crawler map" thanks to this. The map looks great to me and I'd like to hear some useful advice from you. What I'm trying to do is to simplify my logic about 'detect ...
4
votes
0answers
104 views

Simon in Javascript

This is a game of Simon using plain Javascript. I would welcome any comments, suggestions, insights or ideas for improvement. One choice that I made was to have the player's turn compare values ...
4
votes
0answers
294 views

JavaScript Recursive Filtering With AND and OR

I am doing the #JavaScript30 challenge and challenge 06 is to write a "type ahead" application for searching for cities/states. The basic challenge of filtering based on a simple string was rather ...
4
votes
0answers
76 views

Retrieving data to be displayed on a dashboard

I created a dashboard that uses CanvasJS graphs to show data collected by embedded devices. My problem is to get the last ten documents from a cloudant DB for each one of the devices. I've already ...
4
votes
0answers
98 views

Filtering search results for apartment and car rentals

I am developing an app which is somewhat similar to airbnb. There are two search function, one for searching apartment and other for searching car rental. When searching apartment, the result page ...
4
votes
0answers
46 views

Polyfill for a legacy system: Attach “labels” to their corresponding checkboxes

I had to do some maintenance programming on a legacy software recently. Most of the system's logic is done with Java and PL SQL. The Java creates some special kind of XML. These XML is then ...
4
votes
0answers
659 views

Vanilla JavaScript ToDo List implementation

Just started learning JavaScript and I have created a basic TODO list following MVC concepts to apply what I have learnt so far. This is probably overkill for a simple todo app, but the objective is ...
4
votes
0answers
142 views

Assembling and traversing a tree, given a list of items and parent pointers

I've written a function which takes input such as this: ...
4
votes
0answers
60 views

Angular directive to fetch resources to fill a table

I created a directive that solves my immediate problem, but I'm trying to find ways to make it more reusable. My immediate problem was, I have a table and needed to fill in one of the columns with ...
4
votes
0answers
51 views

Store and retrieve set of functions according to options

I have a set of functions to run according to combined options. Options are easier/harder, add/multiply, ...
4
votes
0answers
146 views

2d game enemy entities factories, probably in need of refactoring

So I'm making a 2d shoot'em up game as a way of learning canvas, and larger-scale programming than what I'm accustomed to. I'm a purely front-end web dev, I can't say I'm very experienced in this. ...
4
votes
0answers
131 views

Extensible factory method for starting D3 charts

I'm working on refactoring some existing code to be a bit more extensible and am wanting to create a generic factory API for starting D3 charts. Currently, my factory looks like this: ...
4
votes
0answers
43 views

Reading and updating an XML address file

I have some code that reads from an XML file and updates if needed. I want to move some of the stuff around. Here is the code overall: ...
4
votes
0answers
73 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 ...
4
votes
0answers
353 views

Hunt n' Kill algorithm

Last day I implemented the Hunt and Kill algorithm in JavaScript, using HTML5 without any libraries. I would like my code to be reviewed. How it works I start with a 2D array filled with walls (1-s),...
4
votes
0answers
307 views

Passport user authentication

I'm using Passport in Node.js app to authenticate user by email and password (login) and also by token. Email and password are used only when user is logging in. Passport local strategy generates ...
4
votes
0answers
217 views

Restructure of Express CORS middleware for unit test

How should one break this component down to better perform unit test on its behaviors? Issues: Authentication middleware component makes external request. Must recognize preflight and final flight. ...
4
votes
0answers
86 views

Angular controller scope inheritance vs service

On my site I have a navbar component that I want to customize for each and every ng-view I end up loading. Currently I'm doing ...
4
votes
0answers
84 views

Backbone learning piece, Movie Application using Views, Collection, Models, Routes and Localstorage

I have created a Backbone Movie app as part of a learning exercise, the app is hosted on codepen although I actually have it built on my local but thought this approach would be handier for code ...