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
0 answers
17 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
79 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
127 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
  • 361
0 votes
1 answer
80 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
144 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 ...
Toby Harnish's user avatar
1 vote
1 answer
66 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
78 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
2k 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
131 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
255 views

React component which uses another component for rendering

Having this React component: ...
Leo Messi's user avatar
  • 181
0 votes
3 answers
69 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
82 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
  • 153
1 vote
1 answer
741 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 ...
XM01 - stands with Palestine's user avatar
0 votes
1 answer
56 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
0 votes
0 answers
236 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 ...
Zoran Janjic's user avatar
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
1 vote
0 answers
23 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 ...
shrayder's user avatar
6 votes
4 answers
5k 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 ...
XM01 - stands with Palestine's user avatar
1 vote
1 answer
212 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
121 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
184 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
2k 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
458 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
104 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
83 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
234 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
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 ...
Reinderien's user avatar
  • 59.1k
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 ...
Joseph's user avatar
  • 133
1 vote
0 answers
581 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
2 votes
2 answers
74 views

group computed properties in vue component

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

avoid reassigning variables in javascript [closed]

I have the following piece of code. ...
stockdeveloper's user avatar
2 votes
1 answer
70 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
78 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
545 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
318 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
181 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
72 views

custom array sorting algorithm

So I came up with a "new" sorting algorithm: ...
gurkensaas's user avatar
1 vote
1 answer
230 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
190 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
140 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
182 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
  • 351
-2 votes
2 answers
103 views

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

...
PDHide's user avatar
  • 123
2 votes
2 answers
91 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
148 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
539 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
3k 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
598 views

How to implement a 2D Cellular Automaton in JavaScript?

So far I have this: ...
Lance's user avatar
  • 351
1 vote
3 answers
155 views

Run-length coder

I have this code, which counts only adjacent letters in a string and returns the count of each letter. ...
uday8486's user avatar
  • 111

1
2 3 4 5
14