I’ve been toiling away at this project for a school assignment for a few weeks now. I’d been looking for a challenge. (Why? Why do I like those??!!)
Anyhow, rather than simply throw something together using Java, I decided I wanted to learn something new. My last school program was written in Java. I didn’t want to do the same thing twice. I wanted to get out of my comfort zone. The assignment suggested a web interface. I hadn’t done much web programming so I thought I’d give it a go.
It was hard.
I did a little HTML work many years ago (like 20) and I really hadn’t done a whole lot in the time since. Luckily for me, the internet delivered!
I found a number of very helpful resources.
https://www.w3schools.com/html/
https://www.w3schools.com/js/default.asp
These two sites were my starting points. Although Google delivered as well. I found that using simple Google searches could help me find solutions to issues I was having (like figuring out how to split a string into array elements).
var words = data.split(',');
Incidentally, this is how I did it. I simply copied and pasted my individual words into a large text block and separated each of them with a comma. It took some attention to detail to get each element aligned properly and find the pesky hard return that was preventing the code from working. However, once I found that hard return the array was easily filled.
Why was the array so important to me? I needed a way to recall each individual word. Getting them into an array allowed me to select random words to assemble into a passphrase.
What did I learn?
- JavaScript is very similar to Java in a lot of ways.
- When JavaScript is not like Java, it is REALLY not like Java.
- Doing some HTML programming was worth it. I t is a fairly straightforward way to assemble content for viewing in a web browser.