Week 14 - Notes

This is the last chapter - you have done really well if you made it this far! I genuinely mean it, since the difficulty of the course goes way down after Chapter 9. So, if you are considering withdrawing or doing pass/fail for this HTML course, then keep this in mind. (Obviously, this advice only supplements and does not replace actually speaking to an academic advisor or your professor/instructor.)

Just do the practice exercises and go along with the exercises. JavaScript should be its own computer science course, so this is just an overview for good exposure.

General Notes

JavaScript is responsible for in-browser popup prompts. (This is not to be confused with popup ads opening in separate browser windows, which nearly all browsers should block by default now in 2021.)

Javascript is mostly responsible for making the internet function as a usable tool in 2021, whether you like it or not. (This is why I think there is no practical hope in reviving the Gopher protocol or making Gemini mainstream, instead of HTTPS.)

JavaScript is often unfortunately confused with Java, due to the similarity in name. However, all similarities start and end in name only. Today, JavaScript and its related technologies make webpages dynamically interactive. On the other hand, one application Java is best known for is for developing the Android as an OS and also for developing Android apps (though this is slowly being replaced by Kotlin).

In Section 14.3, JavaScript is shown to be responsible for nearly all alert messages - this is spectacularly abused by websites trying to fool you into thinking that your computer has been hacked with a fake "Your computer has a virus!" message. (However, if you do fall for the site's deception and follow its instructions, then you will most certainly get a virus on your Windows computer.)

Similarly, popup windows have been historically abused so much that website builders should avoid popups entirely. If there is some reason that you absolutely have to use popup windows, then please put an explicit written note stating that users should be expecting a popup window.

Mouse movement techniques remind me that JavaScript essentially allows Facebook to track your mouse cursor in real time in order to try to guess your psychological state... I am really not making this up - however, that is a major digression.

Jump menus and displaying dynamic submenus are legitimate reasons to use JavaScript - though I am pretty sure these can also be implemented in modern CSS.

In Practice 14.1, some debugging is done with JavaScript via the web developer console in Firefox or Chrom* browsers. There is probably a better way for JavaScript debugging purposes, but the textbook's method will work for the final chapter.

In Practice 14.2, use the given code as the basis for your work in the weekly JavaJam assignment.

In Section 14.7, the variable naming convention for JavaScript is mentioned. Variables can have names such as variableNameHere.

In Section 14.8, the scripting programming aspects of JavaScript are mentioned. Unlike markdown languages such as HTML and CSS, scripting languages such as JavaScript can be used to compute some basic arithmetic operations and handle conditional if-then statements for decision making.

In the "Functions" subsection of Section 14.8, the one really useful purpose JavaScript has in an online form is the reset button - which can come in handy.

In Section 14.9, form handling is discussed. Server-side validation will be required in order to check whether the form was filled out correctly, which inevitably requires JavaScript.

Section 14.8 mentions the difference between global vs. local variables in passing. Section 14.9 attempts to discuss that true and false are booleans, not strings, while avoiding mentioning the word "boolean" explicitly.

The JavaScript server-side processing PHP script is not doing anything besides passing a signal back to the user saying that the information as been received and it repeats the what the user input in the form. (If I recall correctly, the PHP script only acts trivially and does not even record any information.)

Plain JavaScript is probably ok for simple alert message boxes, but not that much more. (Mouseover events can be a bit annoying.) However, some users disable JavaScript or have Tor Browser on the highest security setting (which completely disables JavaScript), so you have to be mindful of the needs of all of your users. This is why I like Nitter - Nitter does not require JavaScript to work at all, and it feels fast and snappy (compared to other websites - we are talking about hundreds of milliseconds, but I am not measuring everything like a benchmark fanatic).

Section 14.12 talks about jQuery. To be honest, I would recommend steering clear of jQuery for simple JavaScript activities. jQuery is only somewhat useful if you require some complex JavaScript scenario and the lines of code of jQuery would be much shorter than manually coding plain JavaScript.

Only the Hands-on Practice 14.11 exercise is somewhat justified in using jQuery.

JavaJam Assignment

For the weekly JavaJam assignment, I would recommend going the JavaScript route, not the jQuery route. There is no real benefit of using a jQuery CDN to produce just 1 output line that states when the webpage was last modified.