Tag Archives: september learning challenge

TIL 30: September Learning Challenge

Standard

It seems appropriate to end this challenge by looking back over the month and what I’ve learned. Not just the javascript, or voice in writing, or stress management, but overall.

After the initial enthusiasm for the idea, I confess I was dubious about how sensible it was: did I really need the stress? And my ‘need’ to mix it up and do several topics – not sure that was okay (as if it matters!) or the best for me, tbh. Then again, I am a scanner after all 😉

But very quickly I was impressed about what a difference it made to my usual love of but scatter-gun approach to learning. First, there’s that push to keep going and not start skipping days. I’ve done some javascript before, for instance, but never leaving off for more than a few days powered me through the material fast enough that I hadn’t started to forget the beginning 😉 In fact, that speed of moving through things was quite impressive – I’ve covered a lot in the month, more than I would have without the challenge.

The real eye opener, though, was the daily blogging – not my usual thing, but it really focuses the brain when you know you have to explain things! I gained a few new readers, too, which was interesting!

I’ve also had to let go of a bit of perfectionism. Were all the blog posts brilliant? Hah! But they got done – and sometimes that’s the more important thing.

The last week has been tough, since I’ve had a cold and then Inktober starting – definitely know now to stick to one challenge at a time! But I’m really glad to have reached the end, with 30 posts to show that yup, this September I learned some things! 🙂

Advertisements

TIL 13: javascript 4

Standard

Pressing on with freeCodeCamp! Start at the beginning here or previous installment.

Booleans:

  • true or false
  • nb NOT “true” and “false”

Conditional logic:

code

  • ‘myCondition’ above could also be a comparison operate that equates to true or false. E.g. if(myVal == 10); where ‘==’ is the equality operator (nb do not use assignment ‘=’ by mistake!) or if(thatVal > 9);
  • note that javascript will attempt to convert data types. Thus, 1 == ‘1’ and “3” == 3
  • to get past this conversion, use strict equality to test for value and type equality e.g. 3 === 3 is true, but 3 === ‘3’ is false
  • the inequality operator is ‘!=’, and likewise ‘!==’ for strict inequality
  • logical AND operator ‘&&’ allows two conditions to be tested, with a ‘true’ result requiring both to be met
  • logical OR operator ‘||’ returns true if either condition is met
  • else statements allow for alternate code paths to be triggered e.g. if x do y; else do z;
  • else if allows the chaining of multiple if statements e.g. if a do x, else if b do y, else do z;

Switch statements:

code

  • tests a value and can have many case statements defining various outcomes
  • can be easier to write than chained if/else if statements
  • cases are tested with strict (===) equality
  • a default option can/should be provided for when none of the cases are true
  • multiple cases can evaluate to the same outcome by omitting a break statement, e.g. case 1: case 2: case 3: result = “1, 2 or 3”; break;

Returning Boolean Values (e.g. from Functions):

  • instead of if (a === b) {return true }; else {return false}; you can simply write return a === b; since this returns true or false automatically