Summary
I am a passionate front-end developer who is open to challenges, flexible and quick learner. With warm,
empathetic, and down-to-earth approaches, I enjoy contributing to the team I work with. I have learned the
required skills to be a front-end developer on my own from online courses.
Coding example
https://www.codewars.com/kata/523f5d21c841566fde000009/javascript
Your goal in this kata is to implement a difference function, which subtracts one list from another and
returns the result.
It should remove all values from list a, which are present in list b keeping their
order.
arrayDiff([1,2],[1]) == [2]
If a value is present in b, all of its occurrences must be removed from the other:
arrayDiff([1,2,2,2,3],[2]) == [1,3]
My solution:
function arrayDiff(a, b) {
b.forEach((el) => {
let currentIndex = a.indexOf(el);
while(currentIndex !== -1) {
a.splice(currentIndex, 1);
currentIndex = a.indexOf(el);
}
})
return a;
}