I'm doing an online course and I'm confused with a problem that basically needs to:
So far I have this, but I don't understand why I'm still getting the following error:
Error: Line 21 pixel.setRed is not a function. (In 'pixel.setRed(nR)', 'pixel.setRed' is undefined)
This is my code:
// write your code here
function cPixel (image, x,y){
var img = new SimpleImage(image);
var red = img.getRed(x, y);
var green = img.getGreen(x, y);
var blue = img.getBlue(x, y);
for (var pixel in img.values()){
if (red && green && blue > 0) {
pixel.setRed(0);
pixel.setGreen(0);
pixel.setBlue(0);
}
}
return(img)
}
Thanks in advance for any help. I've tried to use the forums of the course, but the people there seem to be inactive.