Into the Mystery

Into the Mystery

The defeat of Objects (my journey into javascript)

Finally, a triumphant night following some.....disappointing ones.

via GIPHY

" data-card-controls="0" data-card-theme="light">

via GIPHY

The song I'm hearing right now has been a favorite lately, 'Into the Mystery' by NEEDTOBREATHE. (If you haven't checked em out, go for it)

Objects have been my downfall this week. Falling hard. That and the lack of sleep I suppose. When you have a teething 7 month old and a 4 year old with......something affecting sleep......it gets to you!

Ok so Objects. NOT that it in itself is that difficult of a concept to grasp.....conceptually speaking. The syntax however has been killing me! Sometimes it's a comma keeping me from success, or I put a bracket instead of a curly brace. I gotta tell you it feels like we've been cruising at a comfortable level and I've been tracking with the program. Then suddenly I hit a wall and the program took off at super speed!

Ok, I'm being dramatic. But I'm TIRED......

Finally done with the unit, here's my last project;

const team = {
    _games: [ 
      {opponent: 'Broncos', teamPoints: 42, opponentPoints: 27},
      {opponent: 'Rays', teamPoints: 19, opponentPoints: 26},
      {opponent: 'Kings', teamPoints: 20, opponentPoints: 8}
        ],

      get games() {
      return this._games;
      },


    _players: [ 
      {firstName: 'Beverly', lastName: 'Strasburg', age: 33},
      {firstName: 'Brooklyn', lastName: 'TiDoodle', age: 8},
      {firstName: 'Bennett', lastname: 'MacDonald', age: 4.5}

       ],

      get players() {
      return this._players;
      },



    addPlayer(firstName, lastName, age) {
        let player = {
          firstName: firstName,
          lastName: lastName,
          age: age
          }; 
        this._players.push(player);
        },
    addGame(opponent, teamPoints, opponentPoints) {
        let game = {
          opponent: opponent,
          teamPoints: teamPoints,
          opponentPoints: opponentPoints
          };
          this._games.push(game);
      }


};


team.addPlayer('Steph', 'Curry', 28);
team.addPlayer('Lisa', 'Leslie', 44);
team.addPlayer('Bugs', 'Bunny', 76);
console.log(team._players);

team.addGame('Brewers', 76, 19);
team.addGame('Padres', 8, 4);
team.addGame('Chiefs', 46, 12);
console.log(team._games);

The one before this is the one that KICKED MY BUTT. Hours and hours upon days and days. But it paved the way for this project that worked much more smoothly. I guess it goes back to that quote,

"You gotta have the bad days so you can love the good days even more."

-Alexander Cooper from Alexander and the terrible, horrible, no good very bad day

via GIFER

" data-card-controls="0" data-card-theme="light">

via GIFER

I'm once again excited to head up to my computer late at night and learn. Learn for our future, and for a better life. Learn to grow, and learn to achieve. As I sit in my (sweltering hot) office on the 4th level where the heat has risen all day and I can't blow enough AC through the house to cool it, I am excited again to continue learning.

Up next: Higher-order functions. LET'S DO THIS.