Accessing object properties dynamically

This is probably an easy question, but I’m stuck…

I have a custom property called Player (like a basketball player) that has properties for points per game (ppg), rebounds per game (rpg), etc.

I’m designing a piece where users can get averages and compare players across many different categories.

I have a String variable “stat” that tracks which property they want to compare. I can use “stat” in a sorton function, but need to use it to access the object property. So when the user chooses “ppg” or “rpg” i can access Player.ppg and Player.rpg by using the stat variable. Player.stat doesn’t work.

Any suggestions? Thanks in advance.