Created
November 20, 2019 08:26
-
-
Save Sunil-ghodela/6c830517238827e69ef4a4edba6d8f21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pushToFaciltyAndSportsArray(arr, obj) { | |
const index = arr.findIndex((e) => e.value === obj.value); | |
if (index === -1) { | |
arr.push(obj); | |
} else { | |
arr[index] = obj; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment