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
35 views

Re-order table columns in HTML dynamically with Javascript

I've a table in HTML looks like this: Subjects n1 n2 n3 subject1 10 0 0 subject2 0 5 20 ...
0 votes
1 answer
37 views

JS "Tabs" element

How can this be improved? I'm looking particularly at the twice repeated tabButtons.forEach(button => { ...
  • 1
0 votes
0 answers
47 views

Promise to save an image to Firebase and obtain the resulting URL

I'm trying to write a promise that will return me the image URL value that I'm getting from firebase once It is saved to the firebase storage. After some time I wrote the following code and it is ...
3 votes
1 answer
80 views

Function that sorts nestedArray[][]'s

I'm fairly new to coding and am trying to learn more about best practices. I wanted to have an nestedArray of objectArrays, and I wanted to be able to sort the elements in each objectArray based on ...
  • 31
1 vote
0 answers
18 views

Taildwindcss dark mode toggle using javascript object

I'm learning javascript objects and ES6 and made this dark mode toggle for TailwindCSS. I'd like to know what can I improve with this code below ...
6 votes
4 answers
1k views

Generate an HTML table using JavaScript from an array of objects

I've an array of objects and I want to convert it into a visual table in HTML; so I did it last night, but I was tired. I don't think it is the right way of doing it, even though it's working and ...
1 vote
1 answer
46 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 ...
  • 487
0 votes
1 answer
52 views

Range slider show/hides and reset (vanilla js)

I have a HTML5 range slider. i.e. ...
3 votes
1 answer
132 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 ...
0 votes
0 answers
42 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 ...
0 votes
0 answers
22 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: ...
  • 547
3 votes
2 answers
555 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, ...
2 votes
2 answers
114 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 ...
  • 129
2 votes
2 answers
100 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 ...
3 votes
0 answers
62 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 ...
  • 236
3 votes
1 answer
183 views

a tiny rpg game using Phaser 3

I wrote a tiny game using Phaser 3, here is the code. ...
  • 189
1 vote
0 answers
31 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 ...
  • 53.2k
0 votes
0 answers
40 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 ...
  • 123
1 vote
0 answers
221 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....
  • 266
1 vote
1 answer
47 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 ...
2 votes
2 answers
40 views

group computed properties in vue component

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

avoid reassigning variables in javascript [closed]

I have the following piece of code. ...
2 votes
1 answer
65 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 ...
  • 123
6 votes
5 answers
405 views

Extracting a part of a URL path

I have a string like the one below from which I am extracting the tariff name. ...
  • 63
0 votes
2 answers
74 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 ...
  • 602
3 votes
2 answers
282 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 ...
3 votes
2 answers
299 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 (...
3 votes
2 answers
168 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. ...
  • 39
0 votes
1 answer
56 views

custom array sorting algorithm

So I came up with a "new" sorting algorithm: ...
1 vote
1 answer
109 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): ...
2 votes
1 answer
123 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 ...
1 vote
2 answers
82 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 ...
  • 113
5 votes
1 answer
130 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 ...
  • 331
-2 votes
2 answers
103 views

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

...
  • 123
2 votes
2 answers
79 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 ...
1 vote
1 answer
113 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 ...
3 votes
2 answers
212 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 ...
1 vote
1 answer
1k 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 ...
3 votes
2 answers
378 views

How to implement a 2D Cellular Automaton in JavaScript?

So far I have this: ...
  • 331
1 vote
3 answers
122 views

Run-length coder

I have this code, which counts only adjacent letters in a string and returns the count of each letter. ...
  • 111
4 votes
2 answers
321 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 ...
  • 241
3 votes
2 answers
65 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 ...
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: ...
3 votes
0 answers
55 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 ...
  • 31
6 votes
1 answer
447 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 ...
  • 245
2 votes
1 answer
284 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: ...
3 votes
2 answers
61 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 ...
  • 335
4 votes
2 answers
709 views

Vue.js checkout stepper

I have made this small checkout stepper with Vue (v 2.x.x): ...
3 votes
1 answer
226 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 ...
2 votes
1 answer
197 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 ...

1
2 3 4 5
14