A way to flip between 2 textures with space key then automatically flip back to 1st texture?

So I am trying to flip between 2 seperately loaded images with space key then flip back to 1st texture. How can this be done? I don’t use ES6, I am accustomed to ES5.

Thanks!!!

Can you please show with a live example what you have tried so far?