My code is going like this:
function printPixel(nameImage, xpos, ypos) {
var someImg = new SimpleImage(nameImage);
var pix1 = someImg.getPixel(xpos,ypos);
return pix1.getRed();
}
console.log(pix1)
printPixel("drewgreen.png",10, 10);
printPixel("drewgreen.png",250, 500);
The output always tells me that "pix1 is not defined", could you help me with my code? P.S: I edit the code in an online interpreter and the pngs have been uploaded already
I solved the problem by the code following:
and here is another same question that I don't know why it goes like this:
It turns out the same thing: nothing was displayed, anyone can help me with this?