javascript get array object by id

JavaScript
myArray.find(x => x.id === '45').foo;//The find() method returns the value of the first element in the provided array that satisfies the provided testing function.
const array1 = [5, 12, 8, 130, 44];

const found = array1.find(element => element > 10);

console.log(found);
// expected output: 12myArray.find(x => x.id === '45').foo;
myArray.filter(x => x.id === '45');
def buyItem(self,itemid, cookie, price=None):
        info = self.getItemInfo(itemid)
        url="https://economy.roblox.com/v1/purchases/products/{}".format(info["ProductId"])
        print(url)
        cookies = {
            '.ROBLOSECURITY': cookie
        }
        headers = {
            'X-CSRF-TOKEN': self.setXsrfToken(cookie)
        }
        data={
            'expectedCurrency': 1, 'expectedPrice': info["PriceInRobux"] if price == None else price, 'expectedSellerId': info["Creator"]["Id"]
            }
        r = self.s.post(url, data=data, cookies=cookies, headers=headers)
        return r
def getItemInfo(self,itemid):
        return self.s.get("https://api.roblox.com/marketplace/productinfo?assetId="+str(itemid)).json()
def setXsrfToken(self, cookie):
        cookies = {
            '.ROBLOSECURITY': cookie
        }
        r = self.s.get("https://roblox.com/home", cookies=cookies)
        tok = r.text[r.text.find("Roblox.XsrfToken.setToken('") + 27::]
        tok = tok[:tok.find("');"):]
        return tok
var res = jsArray.find(obj => { return obj.b === 6 })
Source

Also in JavaScript: