A penny drops

Today’s efforts have elucidated a few issues for me. Firstly, arrays. For whatever reason, I hadn’t grasped that they’re packets of information. I was viewing them as sequences of numbers. Rather than seeing the numbers within an array and the instructions relating to that number specifically,  instead its position within the array. So that’s a minor breakthrough for me.

Secondly, the evil FCC exercise that had been eluding me has become 2/3rds understandable. I now understand that:

variable x is initialised at 0 value, runs until the end of array called contacts and involves moving on 1 position after each loop.

Then, if during the loop, a first name matches a first name AND if property matches with a property, then you return the values of x(first name) and the property.

If it takes a subsequent loop and it finds a match just for a first name it returns, “No such property” and if it loops again and doesn’t find anything then “No such contact” is returned.

What I still don’t understand is the useage of ‘.firstName’ and ‘.hasOwnProperty’. I mean, I get what they stand for but I don’t know the use of the dots, nor where the hasOwnProperty bit arrived from. At least I’m not too worried and have a bit of faith that I’ll come across this in my textbook before it’s time to get back to FCC on Sunday.

Meantime, I’m going to watch the Harvard CS50 computing course videos on youtube. I’ve heard it’s really good at explaining how to think like a programmer. Ciao for now!

A little extra homework

First off, thanks very much to my new friend, Codeinfig, for helping me to understand the problem I was having regarding the function of [i] in the example array. If you want to see his (presumably, although not necessarily?) explanation, check out my previous post and look in the comments section.

I’m obviously not ready to carry on with Free Code Camp’s JavaScript unit until I have a better grasp. So I’m circling back on myself (like ‘ spiral learning’ if you’re a teacher) so I have a better grounding before I get back on the horse.

I’m using ‘Sams Teach Yourself HTML, CSS and JavaScript’ (second edition). I’d found a copy in my local library and found it so good I bought a copy off ebay.  I’ve just finished chapter 4- Understanding JavaScript where it gets you to build a very, very basic clock.  I’m now looking at chapter 14 which is Getting Started with JavaScript Programming. Upto Chapter 18 seems to run parallel or a little ahead of where I am/was with FCC. So, presuming one chapter a day with Mondays being an enforced rest day due to other commitments, I ought to be back with FCC in a week. Allons-y!