Objective goals

When I write about goals being “objective”, what I’m referring to is them being objects that would be added to an array, instead of just a bunch of strings.

const myGoals = ['Eat less', 'Learn more', 'Ride bike'];

const myObjectiveGoals = [
  { name: 'Eat more'},
  { name: 'Learn less'},
  { name: 'Ride unicorn'},
];

While arrays are contained within [] square brackets, objects are contained within {} curly brackets.

The advantage of using objects instead of strings is that I can add more than one property to a goal. For example, if I want to have a name and a property to see if it’s been completed, I could write this:

const myGoal = {
  name: 'Write boring blog',
  isCompleted: true
};

So let’s compare these different data types:

const myDescription = 'Pay bills';

const myGoal = {
  description: myDescription,
  isCompleted: false
};

const myGoals = [myGoal]