Create live expression

Fix up the double equals then check out this facility.


Note how you can observe g_n changing as you click the image.

console.log

Here is another useful debugging tool - try it out.

function change(image) {
  g_n++;
  if (g_n==3) g_n=1;
  console.log(g_n);
  image.src='pic'+g_n+'.jpg';
}

There's so much more to this behind-the-scenes facility but I hope I've shown you enough to whet your appetite.

My advice is to treat it like a playground and see what else is on offer.
Bear in mind that you can look behind any web page by just right-clicking and choosing Inspect.
You'll be amazed at how riddled with errors many websites are!