All Questions
Tagged with javascript array
398 questions
3
votes
1
answer
91
views
Merge discrete integer intervals
What it does
The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
3
votes
2
answers
86
views
Optimize Working Live Search & Highlight Function
I've written a custom Live Search & Highlight function in vanilla JS. It is working and does what I expect it to.
The issue is that the more items I add to the page content to search, the slower ...
6
votes
5
answers
485
views
Fill missing data in between available data with default value
My raw data has values on some random times:
const rawData = [
{hour: 3, value: 3} ,
{hour: 5, value: 9} ,
{hour: 10, value: 5} ,
] as const
I would like to ...
2
votes
1
answer
63
views
JS animated string builder
Today, I tried to write a simple function that would display the characters of my string one by one by iterating over a string containing the letters of the alphabet and showing the steps on the ...
3
votes
2
answers
324
views
Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values
Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
2
votes
2
answers
75
views
Calculating the sum of all k-sized sub-arrays in an array using sliding window algorithm
I need to calculate the sum of all k-sized sub-arrays in an array using sliding window algorithm. Is that a valid sliding window algorithm? If not, why?
...
2
votes
0
answers
83
views
Javascript basic search engine recipes
I have made a search engine for recipes. Requirements for this JS Project are as follow:
Create a function called searchRecipes that takes all recipes and an ...
3
votes
1
answer
134
views
3
votes
0
answers
59
views
extracting values from an array of nested objects without duplicates
I have my solution for the below usecase but I would like to know whether is any other effective solution for the same.
My Data:
...
2
votes
2
answers
71
views
Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range
I'm trying to optimize a function that takes a sorted list of integers and tells me what is the maximum number of elements in the list between any definite size range. To be clear, the range itself ...
1
vote
1
answer
140
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 ...
2
votes
1
answer
77
views
Helper functions to get, set and remove from Firefox browser storage. Also, to get, push and remove from lists stored in the database
I am making a plugin for Firefox, this is (more or less) my first time working with JavaScript. Is this a reasonable design for working with both values and lists in a database?
...
3
votes
1
answer
133
views
How can I condense my code in node.js for sorting unique values within an array?
Kattis problem - ("I've been everywhere")
I would highly recommend looking at the problem through the link, however I will summarize it a bit here and explain the functionality of each part ...
4
votes
1
answer
170
views
Array Implementation In JavaScript
Review
I have written my own implementation of Array in JavaScript with the basic functionalities. Can anyone please review this code and point out the mistakes/how to make the implementation better?
...
4
votes
1
answer
233
views
JavaScript BitArray Implementation
I am working on a project in which an array can easily grow beyond 50M in length. It's an array holding only boolean (0/1) ...