'use strict';

const image = [
  [
    // Row 1
    [100, 150, 200], // Pixel 1
    [50, 100, 150], // Pixel 2
  ],
  [
    // Row 2
    [25, 75, 125], // Pixel 3
    [200, 225, 250], // Pixel 4
  ],
];

const increaseBrightness = (image, value) => {
  // Iterate through each line of the image
  return image.map((row) =>
    // Iterate through every pixel in the line
    row.map((pixel) =>
      // Increase each RGB value by 'value' and make sure that it does not exceed 255
      pixel.map((component) => Math.min(component + value, 255))
    )
  );
};

const newImage = increaseBrightness(image, 30);
console.log(newImage);
/* 
Expected outcome:
 [
     [
         [130, 180, 230],
         [80, 130, 180],
     ],
     [
         [55, 105, 155],
         [230, 255, 255],
     ],
 ]
*/
