All Questions
17 questions
1
vote
1
answer
68
views
Updating class method to use data from new weather API endpoint while keeping same return value object structure as with old endpoint
I needed to update a class in Node.js that parses the response from a new weather API endpoint but still preserves the same object structure and key values from having been using the old weather API ...
1
vote
2
answers
84
views
Extend native `Array` instances
I need/want to extend created array instance, to add extra methods that i see as useful.
class.labels.js
...
3
votes
1
answer
160
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 ...
2
votes
1
answer
92
views
Generating a performance report for clans in Clash Royale
The following code generates a report showing performance of clan members in a game called Clash Royale.
Everything is pretty self-explanatory, we are working with a lot of https requests, arrays and ...
1
vote
1
answer
576
views
Creating a Navbar Menu from JSON data with Lodash
I am trying to create a navbar menu from JSON data. Actually I have achieved it but I am looking for feedback not to call getItems twice? How can I improve my code?
...
2
votes
2
answers
65
views
Asynchronous array methods chaining
I am trying to check that a list of files are all images using functional programming.
Some actions I go through are asynchronous, so I have to wait for them to completely finish before passing to a ...
6
votes
2
answers
154
views
Concatenating prefix of one array with the reversed suffix of another array
Given two arrays and two indices, I need to concatenate the prefix of the first array and the reversed prefix of the second array.
For example:
...
6
votes
2
answers
116
views
Ensuring Sequence of Events in an Array
The Problem
I'm asking to see if there are methodically better solutions to this problem. The situation is as follows, I am receiving an array of events, they are marked by timestamp and there is a ...
2
votes
2
answers
3k
views
Add new number to sorted array of numbers
The task is to add a new number in the array of numbers sorted in ascending order.
So let's say the array is:
20,40,50,60
And the number to be inserted is 24,
...
0
votes
1
answer
57
views
DoublyLinkedList for node.js
What do you think guys?
...
2
votes
0
answers
141
views
One-based array in JavaScript
One day I stumbled upon a question on Stack Overflow: How do I create an array in javascript whose index starts from 1. The top answer says that it's impossible. However, that answer was posted ...
0
votes
4
answers
16k
views
Move array element to the first position
I wrote an update() function to make an entry the first element in an array.
...
2
votes
1
answer
12k
views
Using promise all with push array
The code's purpose is to call to some function async given some condition was true. I've using the following code which is working as expected. Is there a way to write it better, maybe by not using ...
1
vote
2
answers
176
views
Checking if an element exists in an array efficiently and return it
I am writing a function for my node/angular app that will prompt the user with a random question that he was not asked before.
To achieve this I wrote this function:
...
2
votes
1
answer
71
views
Periodically resizing large array
I have a simple socket.io server written in node. Everything is working just fine, however I am curious whether what I am doing is acceptable.
I am especially interested in this line
...