Skip to main content

All Questions

Tagged with
0 votes
1 answer
53 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 ...
Aaron Goldsmith's user avatar
1 vote
2 answers
62 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 ...
Marc's user avatar
  • 153
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 ...
doroshm's user avatar
  • 33
2 votes
1 answer
86 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 ...
mmaismma's user avatar
  • 123
1 vote
1 answer
569 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? ...
nanokozmos's user avatar
2 votes
2 answers
52 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 ...
Yann Bertrand's user avatar
6 votes
2 answers
139 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: ...
goodvibration's user avatar
6 votes
2 answers
106 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 ...
Ryan Park's user avatar
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, ...
Rahul Shivsharan's user avatar
0 votes
1 answer
54 views

DoublyLinkedList for node.js

What do you think guys? ...
ElSajko's user avatar
  • 133
2 votes
0 answers
134 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 ...
Michał Perłakowski's user avatar
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. ...
roger's user avatar
  • 135
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 ...
Jenny M's user avatar
  • 271
1 vote
2 answers
165 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: ...
Idos's user avatar
  • 113
2 votes
1 answer
70 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 ...
realp's user avatar
  • 165

15 30 50 per page