Skip to main content

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
1 answer
53 views

Combining multiple regexps using the `|` operator and grouping the regexps by their flags

I've implemented a function that creates a multiple regular expressions predicate. The idea behind the predicate is combining regular expressions using the disjunction operator ...
terrorrussia-keeps-killing's user avatar
7 votes
4 answers
849 views

ES6 inner join equivalent

Using the sample data from here, I'm attempting to write JS code (to the ES6 standard) that is equivalent to an SQL inner join. The solution below works fine, but it seems rather long. Is there a ...
knot22's user avatar
  • 469
1 vote
0 answers
53 views

JavaScript: Retry wrapper for the fetch-API

I know there are many good libraries for this, but to understand the issue better, here is my own basic attempt. The fetch will be retried if it fails with a promise rejection or the response ...
Amaterasu's user avatar
  • 205
0 votes
1 answer
75 views

A Chrome extension for analytics debugging: code to render the popup

I made an extension and got it to the point where it does what I want how I want. At this point, I have a little capacity to work on code refactoring, readability and such. And I would love some ...
BNazaruk's user avatar
  • 117
0 votes
0 answers
32 views

News Website using react and next.js implementation

I'm looking for review and feedback on simple news website built using React, next.js, tailwind and nextui. I'd love to get your feedback on file naming conventions, project structure, ways I could ...
sazr's user avatar
  • 191
2 votes
2 answers
106 views

Merge three (or more) arrays based on specific index and create new array

I have three arrays in which first index is same, so I want to merge all three array into one array based on first index element Input: ...
Murtuza Z's user avatar
  • 121
4 votes
2 answers
418 views

Detecting when a user stops typing

I wanted to detect when a user stops typing. I encountered this answer from SO (Not the selected answer, but the second one which seem to be better): https://stackoverflow.com/a/5926782/17746636 But I ...
pileup's user avatar
  • 421
0 votes
1 answer
92 views

Create and store the level data for a remake of Super Mario Bros game

I am trying to remake Super Mario Bros. in JavaScript and I am trying to figure out if there is a more efficient/shorter way to create and store the level data. I have created 1-1 and here's what the ...
Jake Miahn's user avatar
4 votes
2 answers
184 views

Abundant number implementation

I have implementted a simple JavaScript function to find the list of abundant numbers and print them on the screen. an abundant number is a number for which the sum of its proper divisors is greater ...
Napoleon Bonaparte's user avatar
1 vote
1 answer
126 views

Transform an array into object and set index for an unique key in javascript

I have a method that merges keys and indexes from an array into an object. I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler. Goal get an array of objects ...
wittgenstein's user avatar
1 vote
0 answers
81 views

Display a list with (opened and closed) folders

I'm working on a script on Foobar that displays a list of playlists with some of these playlists that can be in a folder (that can be opened or closed). For example: As you can see there may be 2 ...
Sebastien Chemouny's user avatar
4 votes
1 answer
3k views

Merge two dictionaries

This function merges two dictionaries, using the value from the later dictionary to resolve conflicts. I have 5 tests that the program passes successfully: ...
alorl's user avatar
  • 41
-1 votes
1 answer
195 views

Test the log in functionality of a web page with incorrect credentials [closed]

I'm new to playwright, so I'm unsure if this is the correct or best way to go about testing. I basically want multiple tests on the same webpage. I've been able to successfully accomplish this using ...
Aeton's user avatar
  • 3
2 votes
2 answers
260 views

React component which uses another component for rendering

Having this React component: ...
Leo Messi's user avatar
  • 181
0 votes
3 answers
70 views

Filter the array of values from array of another value

I am doing the filter declaring a final array. it seems that the codes are much. it can be shortened? code : ...
3gwebtrain's user avatar
0 votes
1 answer
105 views

Creating custom setTimout function using requestAnimationFrame loop

I created a function using requestAnimationFrame loop that works pretty much like the plain JS setTimeout function (except that ...
gaspar's user avatar
  • 163
1 vote
1 answer
1k 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 ...
XMehdi01's user avatar
  • 523
0 votes
1 answer
70 views

JS "Tabs" element

How can this be improved? I'm looking particularly at the twice repeated tabButtons.forEach(button => { ...
Matt's user avatar
  • 1
3 votes
1 answer
82 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 ...
WyreZ's user avatar
  • 31
7 votes
4 answers
6k 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 ...
XMehdi01's user avatar
  • 523
1 vote
1 answer
291 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 ...
mp252's user avatar
  • 497
0 votes
1 answer
160 views

Range slider show/hides and reset (vanilla js)

I have a HTML5 range slider. i.e. ...
Lieutenant Dan's user avatar
3 votes
1 answer
195 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 ...
Gibberish's user avatar
  • 109
4 votes
2 answers
3k 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, ...
Gibberish's user avatar
  • 109
2 votes
2 answers
755 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 ...
Justin's user avatar
  • 129
2 votes
2 answers
107 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 ...
Jefferson's user avatar
3 votes
0 answers
84 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 ...
thst's user avatar
  • 236
3 votes
1 answer
257 views

a tiny rpg game using Phaser 3

I wrote a tiny game using Phaser 3, here is the code. ...
AlbertJ's user avatar
  • 199
1 vote
0 answers
32 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 ...
Reinderien's user avatar
  • 62.5k
1 vote
0 answers
646 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....
clickbait's user avatar
  • 266
1 vote
1 answer
48 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 ...
Julio Rodriguez's user avatar
3 votes
2 answers
103 views

group computed properties in vue component

I have the following vue component which all works fine ...
Pete's user avatar
  • 641
1 vote
0 answers
70 views

avoid reassigning variables in javascript [closed]

I have the following piece of code. ...
stockdeveloper's user avatar
2 votes
1 answer
72 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 ...
Joseph's user avatar
  • 133
6 votes
5 answers
2k views

Extracting a part of a URL path

I have a string like the one below from which I am extracting the tariff name. ...
Arjun's user avatar
  • 63
0 votes
2 answers
80 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 ...
Elbasel's user avatar
  • 602
3 votes
2 answers
584 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 ...
ablueblaze's user avatar
3 votes
2 answers
321 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 (...
Razvan Zamfir's user avatar
3 votes
2 answers
185 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. ...
G.R's user avatar
  • 39
0 votes
1 answer
92 views

custom array sorting algorithm

So I came up with a "new" sorting algorithm: ...
gurkensaas's user avatar
1 vote
1 answer
265 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): ...
Razvan Zamfir's user avatar
2 votes
1 answer
201 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 ...
huseyin tugrul buyukisik's user avatar
1 vote
2 answers
168 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 ...
Rubioli's user avatar
  • 113
5 votes
1 answer
209 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 ...
Lance's user avatar
  • 341
-2 votes
2 answers
107 views

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

...
PDHide's user avatar
  • 123
2 votes
2 answers
96 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 ...
MauricioRobayo's user avatar
1 vote
1 answer
162 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 ...
Digital Farmer's user avatar
3 votes
2 answers
632 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 ...
Radim Bača's user avatar
1 vote
1 answer
4k 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 ...
Vinay Sharma's user avatar
4 votes
2 answers
646 views

How to implement a 2D Cellular Automaton in JavaScript?

So far I have this: ...
Lance's user avatar
  • 341

1
2 3 4 5
14