skip to Main Content

sort array in a date string property, using lodash or moment() or simple javascript

this is my test array: let testArray = [{'Datum':'13/05/2024','ID':1}, {'Datum':'18/05/2013','ID':2},{'Datum':'01/05/2018','ID':3}, {'Datum':'31/05/2024','ID':4},{'Datum':'31/05/2024','ID':5}] trying to order by Datum property ascending/descending order but it is not happening here is my logic: _.orderBy(testArray, ['Datum'], ['asc']); //not working using moment() js _.orderBy(testArray, (o) => {…

VIEW QUESTION

Javascript – filtering an object-array based on another object-array (orderly)

here is my data: arrayA= [{"studentID":1,"Type":"A"},{"studentID":2,"Type":"B"},{"studentID":3,"Type":"C"},{"studentID":4,"Type":"A"}] filteredArrayOrderlyOn = [{"studentID":1},{"Type":"A"}] (depending on the order the user selects the filters) Output should be arrayA = [{"studentID":1,"Type":"A"}] or if the filteredArrayOrderlyOn array changes because user has control on this selection. filteredArrayOrderlyOn = [{"Type":"B"},{"studentID":1}]…

VIEW QUESTION
Back To Top
Search