Skip to content

Tag: javascript

Organize duplicates into individual array that is ordered

I have an array with numbers. I would like to put the numbers in order and create new array with duplicats in the same array(array in array). Can someone please help me step by step. I would really like to understand Answer You can extract unique values using Set, then sort them (because sorting an array of a…

Compare and Filter Object Array in javascript

How to determine the cheapest and fastest rate and get the value in single object. cheapest is determined by using netfee having least value fastest is determined by using speed having less days best is determined by using amount having highest value I got stuck and let know is any alternative solution. Answe…

How to write this window.history.go(-historyCount) correct

In a piece of code that I am writing, I need the user to go back in its history depending on the number of products there are in a shopping cart. So I wrote this code: But as I expected this part is written wrong. window.history.go(-historyCount); I don’t know the naming so it is really difficult for me…

Calculation in jquery

Trying to get Break Even Point (BEP) and selling value using jquery. Now by running the above code, I entered 1 in the input, so the result (BEP) should be 0, but it gives NaN Answer Because your answer returns with e so it shows NaN. Try: This will give you the result 0.00000000. If you need a result as

catch and handle connection refused error using Axios

I use Axios for my VueJs app and have a Express REST Api. When my VueJs app is not able to call the backend (connection refused / the node server is not running) How can I catch this error? I tried to log the error using an interceptor but when logging the err I only get Error: Network Error with

Using an async function in Array.find()

It seems I’m unable to use an async function as the first argument to Array.find(). I can’t see why this code would not work what is happening under the hood? https://codesandbox.io/s/zk8ny3ol03 Answer Simply put, find does not expect a promise to be returned, because it is not intended for asynch…