Question: Is there a good way to add a certain value to each element in an array in javascript? Essentially, this should be a better way of writing the following:

```
      a = [1,2,3,4];
      for (i = 0; i < a.length; i++) {
          a[i] += 7;
      }

```

Maybe using map (but not necessarily)?

Edit:

Or a more interesting example:

```
      a = [{'x':1},{'x':2},{'x':3},{'x':4}];

      for (i = 0; i < a.length; i++) {
          a[i].x += 7;
      }

```

Answer: 
Based on the wonderfully simple solution from Janusz, here's what I did:

```
let visibleRect = AVMakeRect(aspectRatio: CGSize(width: image.size.width, height: image.size.height), insideRect: self.frame)
if visibleRect.contains(point) {
    // Do something great here...
}

```
**Swift 3.0**

I know its quite late but might help someone in future. Its very simple and inbuilt solution provided by iOS. Just need to: 

`import AVFoundation  

let imageRect = AVMakeRect(aspectRatio: image.size, insideRect: self.imageView.bounds)`