Hi so i have an array of integers which i have been trying to check against my array of objects. I only want to check that ANY of the values in the array are within the objArray, it does not need to be ALL.
const objArray = [{id: 1},{id: 2},{id: 3}]
const array = '1,2'
This is what i tried but i think i am probably way off the logic, i end up getting false every time i run the below code.
stringToArray(array).includes(objArray.some(o => o.id))
Essentially my overall goal to is to validate that any return true and then continue with code otherwise throw an error.
function stringToArray() {
return valueString.match( /(?=\S)[^,]+?(?=\s*(,|$))/g )
}
Thanks for you help! I keep getting false regardless and it may be to do with my function wrapping around the array?, My array was originally a string which i converted using regex to an array.
Thank you in advance!