Depending on your context, adding an explicit 'mediawiki.user' resource loader module dependency might save a later api call to server for gender. That RL module will set the gender at mw.user and you can access by mw.user.options.get( 'gender' )[1]
[1] https://github.com/wikimedia/mediawiki-core/blob/master/includes/resourceloa...
Thanks Santhosh