2022 Developer Survey is open! Take survey.

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
1 vote
1 answer
29 views

Chaining backend calls from VueJS method using Axios

This is the first ever bit of front-end code I have ever written, I have tried to adapt the existing call that is there to the backend using axios, so I check on of the response object value using the ...
user avatar
  • 487
0 votes
1 answer
28 views

range slider show/hides and reset (vanilla js)

I have a HTML5 range slider. i.e. ...
user avatar
3 votes
1 answer
126 views

Randomly set styles with JavaScript

I have created a function which randomly sets styles using CSS selectors. Right now it returns a random item from an array. The program also works with shorthand properties (such as ...
user avatar
0 votes
0 answers
34 views

Differentiating all the numbers in an array with color codes

Here is a working code for differentiating all the numbers with color codes on an HTML page. How could this code be optimized by using built-In techniques or making use of ECMA Scripts? So that the ...
user avatar
0 votes
0 answers
20 views

Configuration of an ES6 module that provides a fetch() (temporary) cache

This code works and it's fine (although it's not yet literate, but that will happen soon) What I am especially bothered by, is the way you configure it. Right now, you use it like this: ...
user avatar
  • 537
3 votes
2 answers
259 views

Download entire localStorage as file

I would like to download the entire contents from localStorage to a json file (in a "clear" formatting). I've tried this and it works perfectly. However, ...
user avatar
2 votes
2 answers
108 views

Find a property of an object in array of objects with the min/max number in another property

So I have notes that have a lastEdit which is a timestamp in milliseconds and a unique id. I ...
user avatar
  • 129
2 votes
2 answers
94 views

Javascript convert number string to Boolean

I'm making this control toggle between hide and show base on the value in this hidden value. I wanted to use a Boolean because I ...
user avatar
3 votes
0 answers
58 views

A prime iterator in JavaScript

This is an implementation of a Sieve of Eratosthenes as [Symbol.iterator] in JavaScript. Comments welcome, my JS is a bit rusty. Making a class of this is mainly the reason to have fun with the ...
user avatar
  • 236
3 votes
1 answer
164 views

a tiny rpg game using Phaser 3

I wrote a tiny game using Phaser 3, here is the code. ...
user avatar
  • 189
1 vote
0 answers
29 views

Embedded Timer Explorer

This is a toy design analysis utility meant to support decisions around configuring a timer on a microcontroller. The initial configuration is an example meant to partially represent the possible ...
user avatar
  • 47.9k
0 votes
0 answers
38 views

Don't Upload Existing Images in React

I have successfully filtered images that are existing in React. My problem is I wanted to improve or use the latest JavaScript on this particular code below where it filters the images. How do I ...
user avatar
  • 123
1 vote
0 answers
127 views

Google Chrome Service Worker Persistent Storage Caching System

Moving from Google Chrome Extensions’ Manifest V2 to Manifest V3, service workers replace background pages. Background pages can be configured to be persistent, but service workers can’t be persistent....
user avatar
  • 266
1 vote
1 answer
46 views

Show selected person in another panel

I was playing with JavaScript in order to practice and wanted to make a list of people, which when clicked showed the person's details in another part of the screen. Here's the code I used to ...
user avatar
2 votes
2 answers
32 views

group computed properties in vue component

I have the following vue component which all works fine ...
user avatar
  • 631
1 vote
0 answers
37 views

avoid reassigning variables in javascript [closed]

I have the following piece of code. ...
user avatar
2 votes
1 answer
62 views

Filter Options in React

I have several products. A product can have 1 or more images. In each image, we have content slot. I don't want duplication per content slot in a product. My code works fine. I'm just wondering what ...
user avatar
  • 123
6 votes
5 answers
289 views

Extracting a part of a URL path

I have a string like the one below from which I am extracting the tariff name. ...
user avatar
  • 63
0 votes
2 answers
70 views

Processing list of users- filtering out from refused list

The code below takes a list of users and displays two lists Refused users Admitted users Sample output: Refuse: Phil, Lola. Admit: Chris, Anne, Colin, Terri, Sam, Kay, Bruce. Any feedback is ...
user avatar
  • 602
3 votes
2 answers
166 views

Tic Tac Toe in object oriented JavaScript

I've been working on a course assignment for 'The Odin Project' and was hoping to get a review of my code. As per the help guide, the code is fully functional. The criteria for this was pretty ...
user avatar
3 votes
2 answers
280 views

PHP blogging application with AJAX loading

I have been working on an online newspaper/blogging application with CodeIgniter 3.1.8 and Twitter Bootstrap 4. The latest feature added is lazy loading of posts. From the Static_model (...
user avatar
3 votes
2 answers
166 views

Check for max value in stack

Got this problem in a coding interview - Get the max value of a stack in O(1). The stack contains numbers only. Please review my solution. ...
user avatar
  • 39
0 votes
1 answer
51 views

custom array sorting algorithm

So I came up with a "new" sorting algorithm: ...
user avatar
1 vote
1 answer
97 views

Vue and JSONPlaceholder application

I have put together this small application that uses the JSONPlaceholder API and Vue.js. The application crosses users and posts and displays the posts by user (author): ...
user avatar
2 votes
1 answer
101 views

Learning asynchronous caching by implementing one

After implementing a serial CLOCK second-chance cache in C++ without having enough rope to shoot myself in the foot, decided to dive into Javascript through NodeJs and write an asynchronous one. I ...
user avatar
1 vote
2 answers
76 views

Javascript - On mouseup check if any of the parents has/includes specific id

On my page I have a mouseup eventlistener on document. I want to be able catch if the clicked elements has a specific ...
user avatar
  • 113
5 votes
1 answer
118 views

How could this indentation-based lexer be simplified?

I finally got this lexer working, full implementation here. How can the lex function be simplified? The goal is to take a tree of indentation-based text, and ...
user avatar
  • 299
-2 votes
2 answers
100 views

Getting items that have more than one entry in the array with optimized code

...
user avatar
  • 123
2 votes
2 answers
75 views

JS script fetching GitHub API for personal website

I've built a very simple personal website, everything is in a single file because it is very straightforward, but I think the JS script could be better structured. All it does is fetch some repos from ...
user avatar
1 vote
1 answer
101 views

list of games to open radar match in iframe on for drop-down controls

In general my page is slow and has several points in the code that I believe can be improved, even in relation to the structure used. Anyway, the biggest problem is: The page I'm creating is very ...
user avatar
3 votes
2 answers
179 views

Single user Electron application allowing basic CRUD operation on a table (stored in JSON)

I am completely new to JavaScript and I will be grateful for your comments on my Electron app (electron is a JS framework allowing to create of desktop apps). I needed to create an application that ...
user avatar
1 vote
1 answer
575 views

Recursively access deeply nested object

Problem Statement I need to access a deeply nested object. I could've used a 3rd party util such as Lodash but insisted myself on writing a Vanilla JS solution with a recursive strategy. Code Can this ...
user avatar
3 votes
2 answers
298 views

How to implement a 2D Cellular Automaton in JavaScript?

So far I have this: ...
user avatar
  • 299
1 vote
3 answers
119 views

Run-length coder

I have this code, which counts only adjacent letters in a string and returns the count of each letter. ...
user avatar
  • 111
4 votes
2 answers
244 views

File naming (two files cannot have equal names)

This is a challenge I completed at CodeSignal. You are given an array of desired filenames in the order of their creation. Since two files cannot have equal names, the one which comes later will have ...
user avatar
  • 231
3 votes
2 answers
63 views

Limit second <select> options based on the first <select>

I want to see if there's a better way to write this code, solely in Javascript. There are two kinds of sets, the first set (C7, T7, C11, T11) have four options in the first select, and then up to two ...
user avatar
11 votes
4 answers
2k views

Restructuring JSON to create a new JSON where properties are grouped according to similar values

I have a JSON structure in the following example format: ...
user avatar
3 votes
0 answers
52 views

Custom HTML Element with scrolling text

A junior developer here. I wrote a simple javascript custom element code here: https://codepen.io/rndbox/pen/mdWxryw as clean as I could with some advice from Junior Vs Senior Code - How To Write ...
user avatar
  • 31
6 votes
1 answer
388 views

JavaScript discrete slider web component

The standard HTML range input element suffers from a number of limitations that caused me to implement the web component presented here. First, it is unnecessarily complicated to style the standard ...
user avatar
  • 245
2 votes
1 answer
279 views

To-do app front-end in Vue 3

I have put together a To-do Application with the Slim framework on the back-end (API) and a Vue 3 front-end. I added a demo on my YouTube channel. In the main App.vue file I have: ...
user avatar
3 votes
2 answers
60 views

concise way to build an object from an array of objects

The following code is working as expected but I'm wondering if there's a way to use Object.assign, or some other approach, to build the ...
user avatar
  • 335
4 votes
2 answers
647 views

Vue.js checkout stepper

I have made this small checkout stepper with Vue (v 2.x.x): ...
user avatar
3 votes
1 answer
199 views

Node backend to run user-submitted code in a virtual machine

As per the title, I'm making a webapp that is intended to use as a JS exercise platform. Problems are shown to users, they submit code, that code is run against a few test cases, and a report of the ...
user avatar
2 votes
1 answer
173 views

JavaScript copy-to-clipboard class

I am have made a small copy-to-clipboard script. I have made a method called copyToClipboard that does the following: create an input box; read the content of an ...
user avatar
4 votes
1 answer
78 views

Javascript Pub/Sub

Here is a short pice of code that suppose to work as Pub/Sub or EventDisptacher of some sort. I only do code in JS a few times a year, so hence I'm asking for your time. Right now I'm working on ...
user avatar
  • 43
4 votes
1 answer
165 views

Randomly rearrange table rows without unnecessary reflows

I recently completed a coding challenge for a company that did not get me to the next stage. They were kind enough to provide the following feedback: The coding assignment does not match what we are ...
user avatar
2 votes
2 answers
43 views

Combine data from array of objects

I got this data structure and I am checking to see which properties are true, then I am adding the key for all the properties that are true to that object on a new ...
user avatar
  • 177
1 vote
1 answer
63 views

A (deep) cloning method for ES-Objects

I have written a (recursive) deep clone method for ES/JS-objects. It seems to work fine, but maybe I'm missing things. Please, feel free to comment! Note: the method will not clone cyclic structures. ...
user avatar
  • 577
3 votes
1 answer
36 views

Get default value from query params + repeating code

The main goal of this task is to take values from the query parameter and put it in inputu. The first problem is that I don't know much about how to do it so that the code doesn't repeat itself and I ...
user avatar
  • 31
1 vote
2 answers
122 views

Recursively find data in array of objects

On this script I look up properties in an array of objects. There is an original array of strings list to get the objects that match the ...
user avatar
  • 177

1
2 3 4 5
14