It may help if you test one thing at a time. If you want to test declarations, then check those, if you want to test scope then check that, and so on.
Also realize that at KA were are operating in a special environment where rules may be forced upon us for our own good.
For example, according to the documentation, variables and functions (whatever) should be able to be used BEFORE they are declared. But (many would agree) that is not good practice, so apparently they decided to take that option away. (see Learn More section
https://developer.mozilla.org/en-US/docs/Glossary/Hoisting)
It would appear, as with Oh Noes, the BabyHints (JSHints, KA, PJS, or whoever) may not treat all the different scope issues the same.
If you are trying to understand how JS works, it may be best to try it outside of KA and PJS. At least that should conform closer to the documentation you will find online. Once you find out how it was designed to work, you can then test it in a KA project and see if it still behaves as it was intended.
For testing you can simply create an HMTL document on your desktop and edit that in Notepad or any other text editor. You simply have to give the file an .htm extension for the OS to try to open it as a web page. So, for example, to show variables can be used before they are declared, open a text editor and paste in the following code:
<!DOCTYPE html>
<html>
<body bgcolor="#F8F0F2">
<script>
message = "Hello World";
document.write(message);
var message = "First contact";
console.log(message);
</script>
</body>
</html>
Then save and name the file test.htm and see if it works for you. Then go ahead and do your tests in that environment and see if it all becomes easier to grasp.
Good luck!
LFS