There is a method called
getmodifierState that is available on
KeyboardEvent that we can use to do so. This can be accessed inside an event listener for a keyboard-related event:
'keydown' method instead of using
'keyup' if we wanted to. But keyup has better browser support, so we prefer using that instead. Let us know in the comments if you have any questions.