Q:

google.maps.LatLngBounds () issue

I am trying to find if a latitude and longitude exists in a rectangle or not. I used following code but its having some issue i donno what.
    function test(boxes) {
for (var i = 0; i < boxes.length; i++) {

        var bounds = new google.maps.LatLngBounds (box[i]); 
        if (bounds.contains(new google.maps.LatLng(22.7287, 75.8654))) {
            alert("i am here");
        // marker is within bounds
        }
        else {
            alert("out of box");
        }
        }
}

if i pass constructor value as 0.0,0.0, it works while if i use boxes[i] its not executing while boxes[i] having the boundaries e.g (17.788,72.828),(21.2620,73.4602)

A:

Based on your comments (you really should update the question), this should work:
function test(boxes) {
  for (var i = 0; i < boxes.length; i++) {
    if (boxes[i].contains(new google.maps.LatLng(22.7287, 75.8654))) {
        alert("i am here");
    // marker is within bounds
    }
    else {
        alert("out of box");
    }
  }
}

