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.

learn more… | top users | synonyms (1)

3
votes
1answer
24 views

Python like kwargs

I'm delving into JavaScript, and ES6, but want to be able to pass additional options to functions after a spread object. Coming from Python, you'd just use keyword arguments, such as ...
1
vote
0answers
24 views

Improving my first npm package - jazzer

So, the other day, I was reminiscing about the old days of jQuery and it's ridonkulous amount of plugins. Then I remembered one which I reeeally liked: smoothState. I was kinda disappointed the ...
1
vote
1answer
25 views

Checking an existing item doesn't already exist in my component's list of items

Here's a function in my PersonList component: ...
1
vote
1answer
86 views

Codewars “Consecutive strings” kata

The challenge description is as follows: You are given an array strarr of strings and an integer k. Your task is to return ...
2
votes
1answer
35 views

Helper method to check if 3 numbers match some of the valid results

I have this helper method to check if 3 numbers match some of the valid results (XXX+bool, XXX, ...
1
vote
0answers
14 views

ES6 template literal tag function and polyfil fetch

The goal of this is to create an easy to use front-end interface to work with graphql APIs. Can anyone tell me if there are any inefficiencies or areas of ...
3
votes
0answers
35 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 ...
4
votes
0answers
55 views

There Was an Old Lady - generate lyrics to a cumulation song

This is a problem from exercism.io. View repo here (contains full example of song). Problem statement: Generate the lyrics of the song 'I Know an Old Lady Who Swallowed a Fly' While you could ...
1
vote
1answer
29 views

Promise Chaining Forgot Password

I have a route I've rewrote to use promises. ...
1
vote
1answer
30 views

Depth First Search (Adjacency List) in JavaScript

I am trying to implement a DFS search and graphs. How can I make it better? ...
4
votes
1answer
31 views

Code for finding the “longest” empty space in a grid

I have written some code to find the longest line of empty space in a grid and I'd like to know if it can be simplified or shortened at all. Here is an example of the input and output of the program: ...
5
votes
2answers
248 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 ...
0
votes
1answer
36 views

Complex class polymorphism and lazy-loaded components

I'm having an issue defining a base class and child classes, which handle initialization differently. I want it to work in ES6 but allow babel to transpile to ES5, and currently babel does not have a ...
1
vote
1answer
48 views

Implementation in js to find if N can be written as X ^Y , N<100

From past year ,i have been mainly working on Js, and so have started implementing Algo Questions in js .can it be implemented in a better way. ...
3
votes
0answers
33 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 ...
1
vote
2answers
47 views

Composing a CSS transformation

I have a function that creates a css transform property string based on some global variables. This string can be copied later by a user, so I would prefer to keep the output short. This is my code: ...
4
votes
2answers
44 views

Generate a series of random integers between 1 and 10

Is there a better way of generating a series of unique and random integers between 1 and 10 in JavaScript (ES6)? ...
2
votes
3answers
59 views

Get the difference between two dates, in the most convenient unit

I use the following code in Javascript to get the difference between two Date objects. I want the result to return the difference in: seconds if the result is less than 60 secs minutes if the result ...
2
votes
1answer
141 views

Quicksort in JavaScript using destructuring and spread syntax

I'm learning Haskell, and there was quicksort implementation, so I thought that I could implement it in a similar way in JavaScript. The result: ...
4
votes
1answer
60 views

A JavaScript implementation of the Python's range() function

Recently I implemented the Python's range() function in JavaScript. The function has three parameters: start, ...
0
votes
0answers
42 views

App for adopting pets

I am building a small app for adopting different types of pets. My API looks like this: ...
1
vote
1answer
38 views

Create an array which contains specific values of a specific nested object inside an array

So I have this array of objects, which respectively contain other objects: ...
2
votes
1answer
235 views

Present table of data, acquired from an endpoint, with option to sort by different values

I have built a Vue app which fetches data from an endpoint and presents that data in a table with sortable columns. The app is based on this React challenge which is to create a table of users and ...
0
votes
0answers
82 views

Using polymorphic objects to represent parts of a deconstructed sentence

I am trying to make a chatbot using javascript by deconstructing a sentence into its intent by separating the Noun's Verb's, Adjectives, Durations's, Numbers etc... to construct a data query to try to ...
2
votes
1answer
55 views

Immutable ES7 global state store

I am quite an experienced developer but I am quite new to JS/frontend/functional programming and I am working with react-native in my day-job now. I'm trying to do my own flux implementation to ...
1
vote
1answer
29 views

Using Bluebird with fs to read a file within each of an (variable length) array of directories

I'm reading an array (of unknown length) of modules package.json files in order to extract the "style" property and store it in an array of its own: ...
1
vote
0answers
42 views

TypingTest Autotyper Userscript

For fun, I decided to inspect the obfuscated source code on TypingTest and figure out how to write an auto typer for it. I came up with the following UserScript. A couple of notes: The site's code ...
4
votes
1answer
73 views

Summarizing and crawling the content of a URL

Lately I've been working on a practice project using JS ES6 to understand it better, therefore I've read a lot about JS design patterns and JS coding strategy. My question is about splitting the ...
3
votes
2answers
59 views

SQL LIKE search in Angular filter objects

I made this AngularJS 1.x filter, to search using a the same SQL LIKE syntax. Right now only the percentage symbol (%) is ...
3
votes
2answers
46 views

Locale language reducer

I am learning redux by doing a small project. Everything is working fine, but I need to know how I can refactor such code. For this situation, it might be good to use ...
0
votes
1answer
42 views

React Todo List App

I have made a small app in React that fulfils the following user stories: ...
4
votes
1answer
48 views

Getting the three next days

I'm simply getting the 3 future days from an array of objects based on the current day to display for a weather component. This is the first time I've attempted using ES6 and it's features so please ...
1
vote
1answer
82 views

Using decorator pattern to validate an entity

I am following this article. ...
3
votes
0answers
44 views

Retrieve index of HTML element within parent

I have a function I've been using for years that retrieves the index of an HTML element within its parent element, or, if a second argument is passed to it, the index of an HTML element within the ...
1
vote
0answers
34 views

Line Graph animation with SVG and ES6 template strings

I've made this animation which shall be incorporated in the header of a webpage. Demo with compiled Sass and uncompiled ES6 code: ...
3
votes
0answers
21 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 ...
1
vote
1answer
38 views

ES6 class that generates an area where you can draw on a page

I have the following javascript es6 class (along with some functions) that generates an area where you can draw in a page. ...
3
votes
1answer
68 views

JavaScript Functional Programming Bank Account, Shop and Customer

Motivation I have worked extensively with JavaScript and have grown fond of some of its functional aspects. This got me wondering how one could implement the canonical example of a bank account - and ...
0
votes
1answer
52 views

Grouping sub-arrays with nonidentical items

I have a 2D array like ...
4
votes
2answers
115 views

Plotting JSON locations using Google Road API with Javascript Promise chaining

I wrote this code for an personal application, just to help me visualize some data related to driving. I have one JSON on my machine, this JSON contains a set of locations (lat, lngs) and every ...
2
votes
1answer
44 views

Handling arguments in a Python-like range() function in JavaScript

I'm making a Python-like range() function (see Python docs) using JavaScript. This function can take from 1 to 3 arguments. There are 3 variables (...
0
votes
0answers
34 views

Using the fetch to return and transform data

I am trying to get data of all users firstnames from an API using fetch. What are the limitations of doing it this way and how can I improve this? (The solution works and the ...
3
votes
0answers
37 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 ...
8
votes
1answer
116 views

A box for comments

I made this as a practice application to learn React. It is simply a box where someone can enter their name and a comment and submit it, and display other comments. This animated GIF illustrates what ...
3
votes
0answers
57 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
2answers
58 views

Calculate amount of elements in collection by property

I was given this task: Calculate amount of elements in collection by property: "name" ...
1
vote
1answer
41 views

Singly linked list implementation in JavaScript

I'm looking for feedback on my singly linked list implementation in JavaScript. Please let me know if you have any suggestions on coding style, documentation, bug fixes, etc. UML / code overview <...
3
votes
3answers
102 views

Checking if parentheses are balanced

This script checks if parentheses are balanced. I wonder if there is something that can be improved here including ES6 features. ...
2
votes
1answer
43 views

Stateless Maximum Beauty of String implementation

Inspired by The Beauty and the Strings question, I tried to implement the "Maximum Beauty of String" in a stateless fashion using ES6. Unfortunately, I ran into two places where I had to assign ...
2
votes
0answers
73 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,...