Typescript Sort with casing and null handling of properties

by Admin 12. September 2019 00:24

 

SortedChildCustomers = childCustomers.filter(x => x.customerName != null && x.customerID !=null).sort((a, b) => {

{

return (a.customerName.toLowerCase().localeCompare(b.customerName.toLowerCase()));

}

})

customerName  & customerID are nullable properties in the childCustomer class

Tags:

Comments are closed

TextBox

Tag cloud

    RecentPosts