JSFiddle - React, Tailwind, and code Playground
JavaScript
console.clear()
const swapFunctionalities = (arr1, arr2, swap=false ) => {
if(swap) {
// arr1.forEach( f => ... )
// arr2.forEach( f => ... )
}
else {
// arr1.forEach( f => ... )
// arr2.forEach( f => ... )
}
}
console.log()