Home » 2015 » December

JavaScript Truthy and Falsy – Pain and Pleasure

If you’ve been working with JavaScript at all for any length of time, you should know by now some of the basic rules of when something is true or false.  And yet, I still see code that messes this up.

At the most simple level I see code that often looks like this:

var trueVariable = true;
if (trueVariable == true) {
    console.log('what a surprise, it is true!');
}

But the person who wrote this code, could have just as easily, and just as clearly written:

var trueVariable = true;
if (trueVariable) {
    console.log('what a surprise, it is true!');
}

Unless, of course, they wanted to know that the variable was both truthy and a boolean.

In which case neither of the two code snippets above would be correct.  In that case, you would want to write the code like this:

var trueVariable = true;
if (trueVariable === true) {
    console.log('what a surprise, it is true!');
}

What do we mean by “truthy” or “falsy”?

image

Continue reading “JavaScript Truthy and Falsy – Pain and Pleasure”

6 Reasons I Moved My Money To …

Way back before I was doing any programming, I was working at Radio Shack in the Chicago area.  Radio Shack, the company everyone loves to hate.  Regardless of what your experience may have been, back in the day, in the Chicago area, it was a pretty good company to work for.  We were encouraged to take stuff home and learn how it worked.  Anything in the store was open to this option.  The goal was that when a customer came into the store, one of us would know enough about the product that we could answer questions confidently.

The other thing they provided that was pretty nice was an employee stock purchase program that vested at the end of each year.  This was a no brainer because they matched up to 3% of your salary.  You contribute 3%, they match 100% of the contribution.  It was like giving yourself a raise.  Because even if the stock went down, we could count on the stock going up again.

That was the beginning of my love affair with investing and figuring out the stock market.

During the run-up to the dotCom crash, I was making quite a bit more than we spent and that all got socked away into stocks.  During those days, it was hard to NOT make money.  So, I did pretty well, as did anyone else who didn’t spend all they made.  This was good, because I spent most of the year after the crash living off those savings!

For the next several years after that, I continued to invest.  The problem is, it took a lot of time away from my keeping up with technology, and the best I could do was maintain my account balance.  Finally, with influences from books such as The 4 Hour Work Week and some other Internet marketing gurus I was following at the time, I decided to start out sourcing my life.  What better place to start than my investing?  So, I interviewed several different financial advisors and ended up giving my money to one of them to invest for me.

Recently, I’ve been learning more about investing and I’ve discovered some rather disturbing facts:

image

Continue reading “6 Reasons I Moved My Money To …”

Values, Beliefs, Green Civics and Programming

I’ve written before about how your beliefs impact your behavior as a programmer in several previous articles:

In fact, many of my post that don’t address a programming skills directly, tend to deal with why we do what we do (or not) as programmers.

But one question I’ve never asked is this, “If what we believe drives what we do, what drives what we believe?”

As it turns out, this is an even more important question than, “what do you believe?” because it also makes you ask follow-up questions that may make you uncomfortable.

image

Continue reading “Values, Beliefs, Green Civics and Programming”