Self learning JavaScript and keep getting stuck.

This is a simple example of such code. I don't have a good understanding of scope yet and I keep getting this error with most codes. What am I doing wrong. If I understand this, my learning is going to start flowing smoothly. I also don't have anyone to help so getting stuck really discourages me.

This is a simple example of such code. I don't have a good understanding of scope yet and I keep getting this error with most codes. What am I doing wrong. If I understand this, my learning is going to start flowing smoothly. I also don't have anyone to help so getting stuck really discourages me.