Skip to content

Tag: javascript

Javscript function running slow

I’m collecting a lot of data from an API with an async function that cycles through a lot of data with a loop, I’m making about 100 requests and it takes around 8 seconds. Are there any methods I can try to use, to speed up my script? Answer Instead of for loops with await inside, which runs in se…

Implementing Lodash Invert

I’m working on a challenge that requires me to implement the .invert() method myself. Below is my solution but the expected outcome doesn’t match with the actual outcome returned. Please see the second block below. Implemented .invert() method: Tested with below code: And I expected to see below i…

How to disable a vuejs router-link?

I have a single-page app that i’ve created using vue, and the nav links are all done using router-link tags. There are a couple of items in the nav that my boss wants to have in the nav but disabled so that people can get a glimpse of some features that will be coming soon. However I can’t figure …

Get user input through Node.js console

I have just started using Node.js, and I don’t know how to get user input. I am looking for the JavaScript counterpart of the python function input() or the C function gets. Thanks. Answer There are 3 options you could use. I will walk you through these examples: (Option 1) prompt-sync: In my opinion, i…