Problem with fully understanding

  • Hi, there! I would be glad to get some explaination or a reference to the last one on the emphasized piece of code inside the switch conditional braces on the screenshot below. It just seems to me not to be covered in the last sections. Thanks beforehand!

okay! let’s break it down! the first thing is the key.which function, which uses the key parameter defined in the keydown function. Whenever a key is pressed, key.which returns a string that identifies it.
then, you have parseInt() which takes two parameters. First, a string that it converts into a integer for use in our switch, and the second parameter (10 in this instance) is the radix (a mathematical term that google can explain better than I can)

let me know if you have any other questions!

Fenris thanks, but stop for a while. Maybe you wanted to say parseInt() function which it’s here as the only switch statement condition and this function being a condition of the switch takes two arguments itself. The first one is key.which followed, as you said, by the radix of 10. This very key.which I wish I understood.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.