Questions tagged [ecmascript-6]

ECMAScript 6 reached feature complete status in 2014. The features vary widely from completely new objects and patterns to syntax changes to new methods on existing objects.

76 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
65 views

Filter by multiple options - also only if not empty

Here's how my json looks like. I'm trying to write a function which filters based on participantCriteria.criteriaType & participantCriteria._id ...
5
votes
1answer
342 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 ...
4
votes
0answers
87 views

Merge Intervals in JavaScript

This task is taken from Leetcode - Given a collection of intervals, merge all overlapping intervals. Example 1: ...
4
votes
0answers
62 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
307 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
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 ...
3
votes
0answers
48 views

Replicating Chrome console's JavaScript object explorer

This is a follow-up post of my previous question: Displaying JavaScript object's structure on page with HTML which looked at how to display all properties of a JavaScript object on a page similar to ...
3
votes
0answers
183 views

Scraping StackOverflow's questions with Node.js

I'm new to node and web scraping in general but with some research I've written this working code. My goal is to get all questions from X Stack Overflow's pages sorted by most rated and save that ...
3
votes
0answers
61 views

Simon game made with ECMAScript HTML and CSS

How does my HTML and CSS look? I'm a beginner so I have no idea if this is good design or not. Is there an easier way to copy and paste code here? Everytime I paste my code in here and use CTRL+K, ...
3
votes
0answers
58 views

Javascript clock/time increment improvement

I've create a time picker component and it works as it should. I've written it in vanilla js. I have learned js purely through writing jQuery and wanted to see if anyone would let me know how they ...
3
votes
0answers
94 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 ...
3
votes
0answers
71 views

Simple JavaScript MVC implementation

I'm learning to use MVC in my JavaScript apps and I thought it might be good practice to write my own MVC implementation. I'd like to know if you see any ways I could improve it or any potential ...
3
votes
0answers
245 views

Uploading series of large files to API via Node

I wrote a node script to traverse a folder of hour-long mp3s and upload them to Mixcloud via their API. It works, but I suspect it's fairly inefficient - the computer it's going to run on at our radio ...
3
votes
0answers
164 views

ECMAScript 6 amazon lambda image processing

I use this script in amazon lambda for image processing. Script should do: download image and watermark from amazon S3 resize image to two sizes put watermark on it and annotate with text put resized ...
3
votes
0answers
378 views

Linear finite state machine in ES6

I would love some feedback on my linear finite state machine. I say linear, as it can only handle one state at a time. I am also giving my method of how I -work- with the state machine, as I would ...
3
votes
0answers
60 views

Join arrays of objects by some identifier

The following is some JavaScript that I wrote to join two arrays of objects by an identifier. The goal is to extend the objects in a1 to include the extra fields in ...
3
votes
0answers
121 views

Tiny Image Editor

I made a small(ish) image editor for a client that is supposed to be able to do the following: initially scale image to preset size to avoid tiny/huge images initially center image in canvas resize ...
3
votes
0answers
38 views

A 'top 100' app that displays list of users ordered in two different ways

I built a small app that gets data from a remote json file and displays it in a list of users. In each list item, an image of the user, their name, and their points tallies are shown. The list is ...
2
votes
0answers
72 views

Determine whether there exists a one-to-one character mapping from one string to another

The task Determine whether there exists a one-to-one character mapping from one string s1 to another s2. For example, given s1 = abc and s2 = bcd, return true since we can map a to b, b to ...
2
votes
0answers
39 views

Simple table sorting using plain Javascript

This is a simple and clean script for sorting a specific column in a table. You could edit and parametrize it to add more customization, but I wanted to share the base concept. Base concept (I think ...
2
votes
0answers
75 views

ReactJS Typewriting animation

One of the dream idea to build typewriting in ReactJS. The code seems to be working, still there are something looks not that great in the code 😔 Looking for better solution (best practice) in the ...
2
votes
1answer
94 views

React Component Design

Building out a React component that is supposed to hold the following information and display it in a feed-like page. The idea is to later map over the individual entries in an array. Author ...
2
votes
0answers
11 views

Combining immutable lists of strings with each other

The Problem Create a javascript method which combines each string of two immutable lists with each other: ...
2
votes
0answers
58 views

JavaScript attempt at an aspect oriented logger using proxies and reflect

I've been playing around with AOP in JavaScript to create a Logger that I can attach to classes and output what is going on (mainly instantiation, calling of functions and the results from functions). ...
2
votes
0answers
41 views

Simple npm module allowing users to create Sets of objects

I'm a junior developer and I've recently created a simple npm module that was designed to allow users to create Sets of objects in JavaScript. This was done by implementing a single class ...
2
votes
0answers
131 views

Advent of Code 2017 Day 6 (part 2) 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 (the 2nd part of Day 6). You can only access the 2nd part ...
2
votes
0answers
94 views

Truly private JavaScript class members (ES6)

I've found pretty simple and clear pattern which can be used to make any data members truly private (invisible, inaccessible) without affecting class behavior (no prototypes and ...
2
votes
0answers
72 views

Angular 1 CSS Encapsulation

I am trying to get a good clean way to do CSS Encapsulation in Angular JS. The main goal of this is to use isolated components. This is what I have come up with so far. The method I am using is ...
2
votes
0answers
42 views

Create exact replica of react component with different name

I have a react native component called "width". It has 3 width values which have associated <TextInput>s which map to the redux store as ...
2
votes
0answers
147 views

Personal resume and project site using React

Recently, I enrolled in the React Fundamentals course by Tyler McGinnis, and afterwards, I decided to rewrite my personal site to entirely run with ES6 React. Since I'm really new at this, I was ...
2
votes
0answers
107 views

Creating instances of a logger class for various logging levels

I provide a class to use but for convenience I want the class to implement some instance methods as static methods. This was fast and concise but it feels smelly, probably because I'm modifying the ...
2
votes
0answers
24 views

Tracking stopped players and connecting them so they can interact

This file handles the player "stopping" in space, trying to find whoever is ahead or behind (also stopped) and joining everyone into each others stopping -rooms. I'm not too sure about the whole "each ...
2
votes
0answers
512 views

Tic Tac Toe AI - library based on Minimax algorithm

I recently struggled with implementing AI in Tic Tac Toe game. For better understanding of minimax algorithm I've decided to separate AI's logic. When I finished I thought that some may find it useful,...
2
votes
0answers
131 views

Animation with JavaScript and Sass : Neon light banner

After reading a bit about CSS3-text-shadows and seeing a few advanced examples I had the idea for a "neon light"-banner. Next idea was to animate it. Finally it has become a mixture between a Sass-...
2
votes
0answers
366 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 ...
2
votes
0answers
120 views

jQuery form change listener, modularized using ES6

I have the following javascript code that I'm trying to modularize using ES6: ...
2
votes
0answers
110 views

Simple native JS Calc

I've never been into web a lot, but I really want to. I started from simple things. I have some experience in .NET and c#. But the world of javascript is completely new for me. I wrote simple ...
2
votes
0answers
428 views

Min-Heap based priority queue class written in ES6

I would appreciate any feedback on syntax, naming convention, possible shortcuts, clarity of code and any other constructive feedback. This code was based off of the Priority Queue chapter in The ...
2
votes
0answers
222 views

Return the Euler Cycle for a graph with es6

My algorithm for finding an Euler tour of a digraph, G⃗, if such a tour exists, starting from some vertex, v. ...
2
votes
0answers
2k views

Flux & async communication with websockets

I want to arrange async server-client communication with websockets and vanilla flux architecture. There is an excellent article about "Async Server-Side Communication with the Flux Architecture". I ...
1
vote
0answers
51 views

Find the square root of n

The task: Given a real number n, find the square root of n. For example, given n = 9, return 3. My solution: ...
1
vote
0answers
15 views

JavaScript code for MAC registration micro webservice

The following code is part of the front-end of a micro webservice for users to allow them to register MAC addresses of their network devices and administrators to enable those and to generate a ...
1
vote
0answers
43 views

JavaScript time series data combination

I've written code that performs a merge of two streams of sorted time series data. The first stream is taken to be the primary and any successive streams are merged into it, using the nearest ...
1
vote
0answers
85 views

Creating a menu for a quiz

I've built a menu for a quiz, where everything is hard-coded apart from the categories, which I'm pulling from an API using Axios. Api.js ...
1
vote
0answers
43 views

Check an ES6 API implementation: can you see anything terrible?

I have just finished writing an API that implements the FULL w3c protocol for webdrivers. This is my first attempt to write fully ES6 code, along with async/await....
1
vote
0answers
35 views

Handling an array of Promises where we care about the outcome of each

Given some data (a job) like, which is from listening in on a RabbitMQ queue: ...
1
vote
0answers
530 views

React, Redux and SignalR connection dependent on global jQuery

I'm writing a react/redux application and I'm on a stage when I need to connect it with backend made with .net using a signalR socket connection. At the moment I've established interconnection ...
1
vote
0answers
143 views

React Bitcoin Exchange Single Page App

I've got a simple single page web app that's build with React. It fetches data from two different APIs, when they have been successfully retrieved, and the promise ...
1
vote
0answers
20 views

TemplateString class for re-usable template literals

I did a little preliminary research and was unable to find a class to create re-usable instances of template string literals, so I wrote my own. Below is the main file (slightly modified to remove ...
1
vote
0answers
120 views

Custom Lightbox Code

I would like someone to review my code and maybe tell me better ways to go about doing certain aspects. I will try my best to breakdown the code and explain what is happening, there is quite a bit ...