Get values for the given key from multiple records in javascript : I have an array of objects as follows.

    Arr = [
    {id:1 val:5},{id:2 val:51}
    ]

I need to get the value when id = 2. How can I do it in javascript?