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
4
votes
1answer
104 views

Sorting an object by value w/ `sort` and `reduce`

Given an object with unsorted numeric values, such as: const unsorted = { green: 80, blue: 90, red: 30, yellow: 100, } We want a data structure with the ...
1
vote
0answers
15 views

Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition

Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways ...
5
votes
1answer
126 views

Working with images in multiple formats

I've been doing some research around how to best make use of the WebP images (with fallback) in React. Most solutions point to something similar to what I've written below. That means if I have a lot ...
2
votes
2answers
44 views

How can I simplify this JQuery validation process?

How can I simplify this functioning JQuery validation process: ...
10
votes
5answers
1k views

Vue.js search functionality

In my BlogList.vue component I made a search input field: ...
3
votes
4answers
106 views

Digital Clock Script

While learning JavaScript I thought it was a good idea to make a digital clock program. I followed a youtube tutorial (with some tweaks to my preference) and came up with my final code that I have. I ...
1
vote
3answers
81 views

Handling arrow keys and tabIndex

I'm wondering how to "beautify"/"simplify" this code: ...
9
votes
3answers
283 views

MMMRjs a product of BYTES Genesis

Hello there, I am Syed Mohammad Sannan a team member of BYTES Genesis We have published a product today called MMMR.js this product is licensed under the MIT license and is built by Syed Mohammad ...
2
votes
2answers
54 views

String data manipulated given CSV variables

The Requirements: List the expensable items sorted by date and location given two variables: 'categories' and 'expenses'. The Categories variable provides the following information in order: Category ...
1
vote
1answer
20 views

Javascript: Mapping combinations of input and possible suffix arrays leads to repetitive if statements

I am writing a program to combine the basic form of a word with suffix arrays following the choices from a form group (Angular 9) to receive the declination. This is the flow: The user inputs a word....
3
votes
1answer
97 views

Leetcode three sum in Javascript

I was doing 3sum question on leetcode Question Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum ...
5
votes
2answers
92 views

Delays using multiple for loops

I got this script which work perfectly but I got some delays because of this 2 for loops [i][j] is there any way to do the same ...
3
votes
2answers
79 views

Huffman Encoding in Javascript

So, I've implemented Huffman Encoding in JavaScript, you can see it live here. Here is the code: ...
0
votes
1answer
66 views

Best way to preload images with callback on completion with pure JavaScript (ES6)

There are many related questions and answers but mostly with JQuery and/or from many years ago. I prepared a version myself, and my question is whether this is currently (2020, hence ECMAScript 6 or ...
2
votes
1answer
125 views

Array of random values that changes over time

I had a project with repetitive HTML, JS code blocks in which should be ten fields (A, B, C...) with certain functionality. Three fields are already implemented, but I don't want to copy and paste ...
0
votes
0answers
27 views

Code for a function that behaves like a promise

I have come up with the following code which behaves like Promise. The interface that this provides is follows: ...
2
votes
1answer
51 views

Find words from dictionary method. Performance improvements

I've implemented a method to solve the following problem: Given a dictionary and a text string, find all words from the <...
5
votes
1answer
49 views

OOP pure JS two Roint Range Slider

I'm currently trying to learn how to OOP in JavaScript by making use of ES6 classes. As an example I created this Slider using classes. I didn't find any class example where the DOM is highly involved ...
9
votes
2answers
382 views

Stack Exchange rev​iew queue notifications

A couple of days ago a user in chat asked us to spend more time in the queues. Kick starting my desire to get notifications for new items in the queues. Reviewing the queues has been something I've ...
1
vote
1answer
28 views

Showing form on btn click - preventDefault of submit btn, then remove listener

I've built out a section on a page that contains multiple instances (why I'm using querySelectorAll()) of this Request Brochure form. They are using Campaign ...
5
votes
3answers
296 views

Sudoku game in JavaScript

PHP coder here. Learning JavaScript this week. I made a sudoku game for practice. Features: Import puzzles by pasting a text string. Imported squares are gray. Your squares are white. Program doesn't ...
1
vote
2answers
97 views

Javascript Anime Support Switch Statement for .animate() Api

This is a revision of a previous question that I asked (i.e. Check browser compatibility for RequestAnimationFrame and Vanilla JavaScript .animate() API), with new aspects that I have learnt in ...
4
votes
2answers
50 views

A function to split an string of alphabets and numbers into arrays and sort them respectively

if I have a string AYUKB17053UI903TBC. I want a function to return ABKUY01357IU039BCT. So every alphabetical part of the string ...
0
votes
1answer
64 views

How to simplify this ES6 Array code

I'm just wondering Is there any ways I could simplify the following code without making it too difficult: Actually I want to extract specific year data from content node based on lastNumberOfYears ...
3
votes
1answer
132 views

NodeJS CLI script to create React apps

Background I crated a CLI tool which executes an npm command (to create a react app) and modifies the contents of the generated files. It was a practice attempt at ...
4
votes
1answer
235 views

Using async / await with dynamic import() for ES6 modules

I am experimenting with the best way to standardise my dynamic import() expressions when importing javascript modules. import() ...
3
votes
1answer
62 views

Swapping Nibbles

I have small (<250 bytes) chunk of binary data, where I know that almost always, the first nibble is going to be zero 0. For example, in hex: ...
3
votes
1answer
55 views

Most performant way to check if elements are overlapping [closed]

I know you can calculate if an element is overlapping another by comparing the top|bottom|right|left properties within the getBoundingClientRect method. However, you need to loop through the elements ...
2
votes
1answer
48 views

Rewrite of Array.join

While rewriting Array so I can practice my javascript, I looked at my implementation of .join(). It seems a little clunky to me. ...
5
votes
1answer
86 views

Program for calculating and ranking scores

Would love feedback on a vanilla JS challenge I've recently completed. It is a method for calculating and ranking scores. If possible, I would love to make it better. Any suggestions welcome. ...
4
votes
2answers
73 views

Transform an object into another object structure

I've got such an input object, which I should modify in order to use it with some charts library. ...
0
votes
0answers
24 views

Small global state handler in React using hooks

I've been working in React for a while now and I decided to try out my knowledge in hooks by creating a small global state manager using said hooks. This is what I came up with: index.js ...
3
votes
1answer
92 views

Implementing `Promise.all()`

I took a stab at implementing Promise.all(): ...
3
votes
2answers
138 views

Rock Paper Scissors game- JavaScript

This is a console version of the famous Rock Paper Scissors game part of The Odin Project curriculum. Please review this code and provide suggestions. Please comment whether the code is DRY and if it ...
5
votes
2answers
189 views

Frequency Queries (Hackerrank)

This is the problem: You are given queries. Each query is of the form two integers described below: 1 x: Insert x in your data structure. 2 y: Delete one occurrence of y from your data ...
3
votes
2answers
78 views

Encode/decode number pairs to letters

My application state is represented by a string of numbers and I'm trying to encode the string so that it is as small as possible (ie. fewest number of characters). An example string would be: ...
4
votes
1answer
38 views

Efficient way to efficiently merge arrays of objects in JavaScript

I have the below scenario where I am trying to merge two arrays of objects. The current code works, but I am looking for a more efficient way. ...
6
votes
1answer
106 views

navigation bar with forward fading links

I'm fairly new to HTML and CSS and I've put together a navigation bar. The purpose of the navigation bar is to be clean and mobile-friendly. I would appreciate some feedback on what I could do better ...
5
votes
1answer
84 views

Javascript To Do Application

I've created a simple JS 'To Do List' application. I'm very new to JS and this is the first JS project I have done. I would greatly appreciate any feedback on how to make the code more efficient, ...
4
votes
1answer
266 views

Disabling a form button while there's an http request running

I have a form built with react, formik and yup, and this form has some async validations. Apparently, some users were able to bypass these validations, and to prevent some errors, I wanted to disable ...
5
votes
1answer
73 views

Return probability (Javascript)

I've been working on a personal project. There's this game called TFT which is an autochess game. Each match is played by 8 players and there's a shared pool of champions, each champion have their ...
6
votes
1answer
121 views

Recursive component JSON configuration builder

My goal here is to make data driven nested forms in React. I've created a function that points to a form configuration JSON, which can contain both components and references to other configuration ...
4
votes
2answers
241 views

Blogging application with Codeigniter back-end and AngularJS front-end

I am working on a blog application with Codeigniter 3.1.8 and AngularJS v1.7.8. The Dashboard of the application is "pure" Codeigniter, with Models, Controllers, and views, while the fronted is made ...
4
votes
2answers
180 views

Alternative code to classes in Javascript?

I'm new to JavaScript and came across classes in ES6. Though they are great, I don't want to learn something that can be done in other ways. So, I created this code that does somehow similar job to ...
1
vote
0answers
41 views

ES6 Class for getting GitHub PR info

I was learning some DOM manipulation and interaction with third-party APIs by building a simple interface to get the people who commented on a PR on GitHub. I got great feedback for my initial ...
1
vote
1answer
34 views

Adding values to FormData - javascript

...
2
votes
1answer
69 views

Modern HTTP-Requests for login/register system

I am working on a login/register system and want the register and log in process as smooth as possible. One way of making it smoother is in my opinion to make a multi-step login/register. What I ...
6
votes
0answers
110 views

Node.JS Protobuf socket client with TLS support

I'm working with one environment which allows me to execute node.js code from single file without installing additional modules. My task is to write simple ssl socket client which will send protobuf ...
5
votes
2answers
100 views

Simple replacement for Redux in ES6

The idea about this code is that it's a full replacement of Redux — in 22 lines of code. ...

1
2 3 4 5
12