Skip to content

Tag: ecmascript-6

Filter Array Javascript/typescript

I have an array that needs to be filtered with specific condition If any value has -backup has suffix then it should take that and it should avoid the one without backup . Here fghij-backup has value with backup so that is the priority. If the value doesnt have backup has suffix then it should take it has pri…

Get the Second Highest Date in JavaScript/ES6

I have a problem getting the second highest date in ES6. I’m using moment.js too. Its supposed to be getting the id of 3. Answer You should use custom sort function as: There is no need to use find when you are reverseing the array and getting the index 1 from it. Note: I deliberately change the order o…