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
0
votes
1answer
49 views

Return the first word with the greatest number of repeated letters

I'm learning JavaScript and have written a function that accepts a string and returns the first word with the greatest number of repeated letters. For example: Input:"Hello apple pie" - Output:"Hello"...
1
vote
1answer
43 views

Turn a list of words into a dictionary

I am looking for a way to turn a list of words that may have duplicates into a dictionary/map that counts the number of occurrences of words. After spending some time with the problem, this seems to ...
4
votes
1answer
583 views

Vue + Vuex + Firebase serverless realtime chat

I am "discovering" Firebase and I'm trying create simple chat with Vue, Vuex and Firebase. But because I'm just starting out with Vue, I need code review or advices from more experienced programmers. ...
0
votes
1answer
38 views

Is this a good way to use Try catch? [closed]

I'm new to handling errors and am not sure how to do it, basically, in a speicific request err.code === 11000 is not actually an error, but expected behaviour. I ...
6
votes
3answers
494 views

Compute count of unique words using ES6 sets

I have written a function which counts how many unique words are included in a given text. The source-code: ...
2
votes
2answers
78 views

Simple form validation in javascript

Used to use Laravel's easy to use form validation class, decided to mimic it in JS. I've been learning JS for 4 days now and decided to write my first piece of real code. I'm pretty sure its full of ...
3
votes
1answer
55 views

Vue component over-complication

I'm building a date range selector, and while this works, I feel like I'm making it more complicated than it needs to be. Is there a more elegant way of writing this? Possibly using computed values ...
2
votes
1answer
60 views

O(n) Object Pool

I recently rewrote my object pool design to \$O(n)\$ complexity. I did this using a linked list, which is not native in JavaScript. It does not, unfortunately, automatically assign ...
1
vote
1answer
30 views

duplicated operator(or attribute) on the same input control - v-model and @change

I wrote a code like below - It is nuxt.js, which is one of the Vue frameworks. This code will be expected to When change event triggered, update ...
3
votes
1answer
69 views

Validity checks for a user signup process

Background: I have been working on a service which allows users to signup on different apps and on each login checks if the request is valid or not based on a series of checks. The below snippet is ...
2
votes
1answer
83 views

create static page with vuejs

I have a static homepage with some routes and thought about creating this with VueJs. I am totally new to this and just know NodeJs with Handlebars. So normally I would have something like this <...
2
votes
2answers
113 views

JS calculator, respecting order of operations

I have a function that receives an array of numbers and operations Ex: userEntry = [3,+,3,x,3] -> returns 12 It is a calculator that adheres to the proper ...
2
votes
1answer
38 views

Request for improvements on a simple React app

I'm looking for a review of a recent project I finished for school. It is an app that functions like Twitter. It includes an Express server and Routes. Instead of using databases, it uses JSON files. ...
2
votes
1answer
665 views

TamperMonkey script to add a button to Jira

The below script detects whether we are in Jira, and if it is run in Jira it will add a button. Clicking that button will use the REST API of Jira to create an issue, and navigate to the recently ...
5
votes
2answers
98 views

Event emitter npm module

I was asked to complete the task described below: Event Emitters are objects that serve as the core building block in event-driven architectures. They simplify the process of handling asynchronous ...
4
votes
1answer
1k views

My first animated data grid with Vue.js

Because this is my very first attempt to create a data grid with Vue, I would like to know about all misconceptions used in my approach. Whomever points to the most important shortcoming / weakness in ...
2
votes
1answer
3k 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
2answers
140 views

Validate Email as User is typing (JavaScript)

I have the following javascript function validateEmail(value). The goal of the function is to validate the users inputted email as they are typing. So if someone puts nfg@*gmail.com the email will be ...
1
vote
1answer
46 views

Traversing the Parent-child relationship between objects: Part 2

This code builds on the code in the previous iteration. All of the following tests should work: ...
0
votes
1answer
34 views

Best Approach for Assignment Code in Node.js (ES6 style) [closed]

Is there any way to improve this code? Using ES6 style i am using latest stable version of node.js. ...
4
votes
1answer
109 views

Audio frequency trainer / tester using Web Audio API

I'm making an audio frequency trainer as a learning exercise. It could be useful for audio technicians who need to recognize audio frequencies (eg. when ringing out feedback during a live concert or ...
8
votes
3answers
532 views

Draw sine wave going around a circle

I have used d3 to draw a sine wave going around a circle. This is the very first time I've used d3 or drawn a SVG and I'm fairly new to JS as well, so I don't know if I've overcomplicated it/if there ...
5
votes
5answers
412 views

Average of two hex colour values

I have submitted the following bit of script as the answer to one of the tasks I was set by a recruiter. My submission has already been made and cannot be altered. However, I am keen to ask how you ...
-1
votes
1answer
67 views

Combine Matrix Columns JavaScript

I did this Codepen to combine all the columns from one matrix in JS. ...
5
votes
1answer
149 views

Animating a screw made up of elements

I am working on code to generate a screw made up of different elements and animating it by rotatation. The elements are so called conveying elements (denoted by GFA)...
6
votes
1answer
77 views

map of SF transit cars

Please provide general and any specific criticism of the following which is intended to provide a map of SF transit cars. The code can be viewed in the working version and also in a group of gists. ...
7
votes
1answer
575 views

Electron Application with JavaScript Backdoor and Ruby Command-Line Listener

I have created an Electron Application with a JavaScript/NodeJS Backdoor and a Ruby command-line listener. I created this program for remote administration of my home computer securely using a new ...
2
votes
1answer
101 views

99 bottles of beer on the wall + EcmaScript 6

Today, a solution written in Python was posted to this challenge, and since I was inspired by it, I made a version in EcmaScript 6. I tried to explore some new language constructs: arrow functions ...
1
vote
1answer
41 views

Initialize an object with a key at runtime

Often I want to construct an object with a runtime-generated key. Here's how I have been doing it: ...
2
votes
1answer
94 views

Simple Duration calculator using es6 class syntax

I've written a simple script that calculates the distance between two points in time and returns the duration. Example: Start - 11:00, End - 11:45, Duration - 0.75 I wanted to make use of ES6 ...
3
votes
1answer
64 views

Altering SE sites to imitate SO's appearance

Some time ago someone complained that sites that were not stackoverflow were hard to read at work since people might be screen watching. So I bashed some code and created SO-ify. Some time and several ...
4
votes
1answer
255 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
2answers
268 views

Arkanoid/Breakout clone with ThreeJS

Here's my attempt at an Arkanoid/Breakout clone using JavaScript with ThreeJS. The feedback I'm looking for is more on the code side; the game itself is a work in progress. You can take it for a spin ...
2
votes
1answer
65 views

Javascript / ES6 parse value from arrays of objects

I want to write a generic parser which takes a value, and type and returns label of given value instead. Currently, this is my code: ...
3
votes
1answer
723 views

Mapping key value pairs between two JavaScript objects

I have two JavaScript objects: ...
6
votes
2answers
319 views

Cake-ordering form and calculator

I’m a designer learning to code and I’ve built a simple form calculator for ordering cakes. I would love it if you could show me how to make the code more idiomatic. How can it be more consistent, ...
5
votes
1answer
1k views

Colour-matching game

This is a game about matching the right colour. In the first level you start with 3 cubes that each have a different colour. After 2 seconds the colours of the cubes disappear and the cubes become ...
4
votes
2answers
3k views

Reactjs Tab Component

I made a simple bare bones Tab component, i'm a beginner when it comes to ReactJS so any advice regarding the codes functionality is greatly appreciated. Tab.js Component ...
4
votes
4answers
98 views

Filtering a name Array in JavaScript

I was wondering if there is a better, more elegant way to write the following JavaScript code block: ...
0
votes
2answers
72 views

JavaScript Armstrong Number Validator (ES6)

I have the following function which takes in an input and validates if that input is an Armstrong number or not: An Armstrong Number is a number such that the sum of the cubes of its digits is ...
8
votes
4answers
1k views

Test if a string is a palindrome

I got this out of an article on interviews / code challenges. The challenge text goes like this: A palindrome is a word, phrase, number, or other sequence of characters which reads the same ...
1
vote
1answer
57 views

Building query params which append to URL in a browser

I was looking for a similar JavaScript method for http_build_query but did not find but create my own and here I am a bit confused to decide the right approach. ...
5
votes
2answers
118 views

Upvote/counter in Javascript

Looking to improve building UI in pure ES6. This is the pattern I have adopted and has worked fairly well. This code increments the count, sets a data attribute to toggle the button, and issues a ...
2
votes
1answer
1k views

Greasemonkey script to auto fill the values of a form on a specified page

I created a Greasemonkey script to allow me to quickly fill a specific form on a specific URL, for testing/dev purposes. If the current URL matches any of the urls found in the ...
5
votes
1answer
552 views

Traversing the parent-child relationship between objects

I wrote this code because I was often annoyed that I couldn't get the parent object. This class allows you to traverse the parent-child relationship between objects, in both directions. It also ...
0
votes
1answer
52 views
3
votes
2answers
46 views

Making the font as big as possible without overflowing each div

I made a function that makes font sizes in <div>s as big as possible without overflowing. It takes a long time to run. How do I optimize this? ...
0
votes
2answers
4k views

Filter array of objects by comparing nested object properties

I recently had a problem whereby I wanted to filter objects in an array by comparing the values of nested properties of each object to see if there were duplicates. I have tried to explain as ...
3
votes
2answers
623 views

Creating nested objects from string

I implemented a method, to create an object based on a series of strings that are passed to it, of any depth or length. The way I implemented the solution was to map over the arguments. Assuming that ...
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: ...