Skip to content

ternary operator within .filter()

A simple example. Is there a way to get something like result = numbers.filter(num => num%2 (evens) ? === : !== 0) where depending on ‘evens’ to use equals or not equals to 0 within the .filter function? Is there a way to reuse same function to not have replication? Answer How about just result…

Unit test a method called from a method

I have an angular application and a method that gets provoked on click. In this method I am passing a value to another private method. .ts file public onViewItem(item: Results): void { const ids = …