Solución
solution.tsTypeScript
function arrayDifference(firstArray: number[], secondArray: number[]): number[] {
const notRepeat = [];
firstArray.forEach( (element) => {
const isRepeat = secondArray.filter( (num) => num === element );
if (isRepeat.length === 0){
notRepeat.some( (num) => num === element) ? '' : notRepeat.push(element);
}
});
return notRepeat;
}
// No modificar: necesario para evaluar el resultado.
export { arrayDifference };0respuestas