The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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.

Filter by
Sorted by
Tagged with
2
votes
0answers
111 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 ...
0
votes
1answer
182 views

Javascript pager logic

I implemented a function for pager link creation, it looks like this: ...
5
votes
1answer
135 views

Count groups of open cells around a cell on a grid

Consider a 3x3 square surrounding a cell (marked @) on a grid: 0 1 1 1 @ 0 1 1 1 I need to find the number of groups of open cells (ones) surrounding the center ...
2
votes
1answer
3k views

jQuery templating with ES6/ES2015 template strings

I have been using a particular pattern over and over again when I want to keep my jQuery apps more safe from XSS. I do something like this. (It uses ES6 template strings) ...
17
votes
1answer
45k views

Using fetch() and a new Promise object to get API results

I've written an ES6 function using the new fetch() API and returning a new resolved promise with a data object or a rejected promise with an error subclass. I'm pretty new to both ES6 and Promises, ...
3
votes
2answers
542 views

ECMAScript 6 budget calculator

I never get to use ECMA6 in production/work, so I am hoping you all can help me write better code by reviewing my finished sample: ...
10
votes
1answer
4k views

Node.js parallel file download, the ES6 way

I wrote a script that downloads all PDFs found on the web page of a particular government agency. I would have chosen bash for such a task, but I want the script to ...
1
vote
0answers
101 views

Code kata featuring: fetch, promises, Array.sort, Array.reduce, Array.map, String.localeCompare

I just finished a kata and would love to get some constructive feedback regarding code quality, readability, organization. Objectives fetch members of polish parliament (poslowie) group them by ...
1
vote
1answer
118 views

Creating a loading sequence of an application

I am using Webpack to create a sort of loading sequence of the application. I can simply call prepareInfosite().render() and I don't need to care about the hidden ...
3
votes
1answer
157 views

Simplified Caesars Cipher

I'm studying functional programming, and I have the following problem to solve. It's an simplified version of Caesars Cipher: You need to write a function, which will take string encoded with Caesar ...
77
votes
6answers
7k views

You hate h̶a̶t̶s̶ reputation? Click here to get rid of it

Soo... I recently read a meta-post about the inherent problems of reputation. It listed some things like: Confirmation bias. Demotivating for low-rep users. Hubris and elitism of high-rep users over ...
3
votes
1answer
95 views

Chain of promises

Often I end up with ...
5
votes
1answer
140 views

Animation Template Method for Snake Game

I have recently finished my first iteration of a template method implementation for a JavaScript canvas animation of the snake game. However, I would love for the community to critique this code and ...
2
votes
2answers
105 views

Extracting values from refs pointing to form inputs

I have a form component with multiple refs pointing to form inputs. On submit, those inputs' values need to be passed the into form callback, structured as an object. Currently, it's achieved like ...
4
votes
1answer
76 views

JavaScript (ES7) LOC counter

I've been writing JavaScript for a couple years but nobody's ever really looked at my code. This is a small library I wrote to check code modularity, w/ input like ...
0
votes
1answer
34 views

ES6 block-scope variable usage

I am experimenting with ES6 using BabelJS in a codepen project you can find here. I am confused as to why my code breaks when I decide to use let instead of ...
2
votes
1answer
120 views

Date picker consisting of three component pickers

I made a UI picker tool, like a "rolling select" to pick vales (demo here). I made first a independent module with a ES6 Class, basically: ...
1
vote
2answers
1k views

Finding the positive numbers count in an ECMAScipt array

All I am trying to achieve is better use of built-in ES functions. ...
2
votes
1answer
462 views

Simple recipes web app with Redux

I have completed a coding challenge from Free Code Camp. The challenge's user stories are as follows: I can create recipes that have names and ingredients. I can see an index view where the ...
0
votes
1answer
42 views

Creating and finding posts using Parse.com

The following code calls Parse. And uses its API to create two functions: post.create and post.find. As the names imply, one is ...
5
votes
1answer
132 views

VCF parser for eventual genomic data visualization

I've just started out writing an app that will visualize genomic data for anybody to understand. When you get your genome sequenced the raw data usually comes in the form of a VCF file. I started out ...
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 ...
3
votes
2answers
8k views

Range iterator in ES6 similar to Python and Ruby for

Background and Purpose For those unaccustomed to Ruby, Ruby supports range literals i.e. 1..4 meaning 1, 2, 3, 4 and ...
1
vote
1answer
5k views

Pagination logic created from scratch

I created this JavaScript class using ES6-ES7 syntax to return an array of page numbers and ellipsis points (null) to be consumed by a function which will create a styled paginator. What I am looking ...
1
vote
0answers
430 views

Async process to send a contact email and confirmation message

Using nodemailer and node-email-templates to send a contact email and confirmation message. As is, I can catch any errors, but (if a file attachment is included), this process can take up to 30 secs ...
8
votes
1answer
225 views

React & ES6 news app

I have written a small app that fetches news items from an endpoint and displays them in a grid. I used React to create components and use them throughout the app. This is the first thing I have ...
2
votes
0answers
435 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 ...
3
votes
4answers
625 views

Finding the max sequence finder

Problem Statement Find the max sequence finder. findMaxSequence([3, 2, 3, 4, 2, 2, 4]); ...
2
votes
0answers
229 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
2answers
7k views

Reduce array of objects into object of arrays

I have an array of objects where each object has two keys: key (k) and value (v). I need to make an object that would take ...
5
votes
1answer
340 views

Node bot to send out reminder emails for forgotten employee weekly schedule submissions

This CalendarService is part of a little node-bot I wrote today which sends out reminder-emails if a team member forgets to submit his weekly schedule in time. ...
5
votes
1answer
2k views

Recursive, depth first search

I wanted to write a function findDeep that would perform a recursive, depth-first search on plain objects and arrays. Comments and criticism welcome. ...
2
votes
1answer
448 views

ReactJs Tabbed component

I've written a simple tabbed component in ReactJS, whose purpose was to make defining different tabs very simple. My implementation does this very well in my opinion, since defining tabs becomes very ...
1
vote
0answers
111 views

JavaScript plugin architecture for multiple methods with the same parameters

I am writing a JavaScript plugin for fun. The plugin allows the user to pass options to initialize the plugin and perform actions. It is a simple alert/confirm plugin just for fun. I am hoping to ...
5
votes
1answer
73 views

Using generators to build up a maze

In prepping to teach a workshop on recursion I wrote this code that uses a maze-building algorithm. In doing so I found it really natural to use generators a lot. I feel pretty happy with how the code ...
1
vote
1answer
283 views

Currying addition function in ECMAScript 6

I wanted to write an add function that implemented currying in JavaScript. I welcome criticism and suggestions for improvement. ...
0
votes
1answer
67 views

ES6 call `this` in Array.filter

Does exist a cleaner way to call a static method inside ES6 Array.filter function ? ...
1
vote
1answer
69 views

Long arithmetic addition implemented in functional style

This implementation uses ECMA6 syntax and babel as transpiler. You can use this code to add integers which are bigger than Number.MAX_SAFE_INTEGER. ...
10
votes
1answer
4k views

HashMap and HashSet classes for ES6

The new EcmaScript standard, ES6, contains specifications for Map and Set built-in classes. Each of these collections treats an ...
2
votes
1answer
1k views

Sum an array of video lengths in JavaScript into HH:MM:SS

I am trying to learn functional programming in JavaScript, and saw a little task on Twitter that I wanted to have a go at: ...
1
vote
1answer
886 views

Knockout computed observables in ES6

I am trying out for the first time knockoutjs and babeljs and have a question on how to do computed observables properly. Both fullName and ...
2
votes
1answer
726 views

Return React child component based on current state

I am trying to build a multi page form widget with React for a website inspired by this. Since quite some time has passed since I last touched JavaScript, I'm directly adapting to ES6/7 and tried to ...
1
vote
1answer
124 views

Node.js drawing game based off of my state diagram

I really want to have a nice design pattern for my Node.js project. This is my state diagram. As I'm coding this, I'm wondering if it's better to separate state logic from the class? So instead I ...
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 ...
0
votes
1answer
123 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 ...
3
votes
1answer
53 views

Building a unique array of db fields

This is stripped down from a project I'm working on: ...
10
votes
2answers
159 views

String sequence in ES6

Given an unique string that represents a sequence of characters, the class should implement three methods (getNextChar, getNextString and the genSequence generator). How it works We give a sequence ...
1
vote
2answers
73 views
7
votes
1answer
161 views

Processing files with streams

I'm using io.js. I have to read some files as a stream, process them with the same function, and join them back into a stream. I decided to create my own solution with ...
6
votes
1answer
136 views

Generate probabilities around a numpad

Currently, I'm working on a game with directional movement influenced by the numpad. The player AI should intelligently pick a direction to move (so it's not entirely random, and can be somewhat ...