Skip to content

Instantly share code, notes, and snippets.

@Sunil-ghodela
Created November 20, 2019 08:26
Show Gist options
  • Save Sunil-ghodela/6c830517238827e69ef4a4edba6d8f21 to your computer and use it in GitHub Desktop.
Save Sunil-ghodela/6c830517238827e69ef4a4edba6d8f21 to your computer and use it in GitHub Desktop.
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