davidturnbull/leaderboard-v4

In leaderboard.js, could use Session.equals instead of Session.get and == operator

Opened this issue · 0 comments

I found that the Meteor documentation states that using Session.equals is preferred to using Session.get and the ==/=== operator to test if a session variable is equal to a value. The code inside the selectedClass helper function in leaderboard.js could be changed from:

var selectedPlayer = Session.get('selectedPlayer');
if (playerId == selectedPlayer) {
  return "selected";
}

to:

if (Session.equals('selectedPlayer', playerId)) {
  return "active";
}

However, I am currently quite new to Meteor and have only just been learning how to use Meteor using your leaderboard tutorial, which is really good by the way. 😃