Trigger click of object in canvas

     var x = e.clientX
      , y = e.clientY  ,
      for(var c=0; c<10; c++) {
        for(var r=0; r<5; r++) {
                //var brickX = (c*(brickWidth+brickPadding))+brickOffsetLeft;
                //var brickY = (r*(brickHeight+brickPadding))+brickOffsetTop;
                xx= this.bricks[c][r].x 
      //            if(Math.pow(x-xx,2)+Math.pow(y-yy,2) < Math.pow(xx,2))   {
      // console.log('hit')}}}

This is what I got so far I want to define the x y of the click and if it is in the bounds of a brick console log ‘hit’ but it doesn’t seem to work this formula was for a circle, but I tried to modify but no luck anyone has a suggestion?