P5.js code for creating a calculator tip app confused

Great progress here!

Basically you can check if img != null