I have an array of items. They are in a FlatList in React Native (not super important). I'm trying to use the find method on the array to find the matching object of the selected item. When i get the matching object, the ID that I'm looking for is only correct up to the first 16 digits. The last 3 digits are always 0's
onPress={key => {
let selGame = projects.find(game => {
return game.key === key
})
console.log(selGame, 'selGame.ID') // {title:'title', ID:1234567891011123000}
}}
console returns:
{ title:'title', ID:1234567891011121000 }
expect console to return:
{ title:'title', ID:1234567891011121314 }
this occurs with multiple IDs for my Games. Any help would be much appreciated
The reason why your code doesn't work is because the number is too big. Most systems don't like numbers that big, and they just mess up the number. To get it to work, the easiest way would be to convert it into a string.