There are a bunch of ways to do this, and your way should work just fine.
I normally recommend you use a “toggle switch” variable for your jump button.
Here is the method I use to allow for jump sustain (holding jump = higher jump), coyote time (player has a few frames to jump after walking off the edge of a platform), and jump only once per key press.
