Assigning a JS function a key?

Hi all

I have two functions for my program:

function clickPlus() {

function clickMinus() {
  var currentValue

How can I assign a keyboard shortcut to the function? I got mousetrap, but I can’t really figure it out.

Thanks so much in advance!

If you click + on your keyboard, it would call the function hello

Mousetrap.bind('+', function() {

function hello(name) {
1 Like

Okay, I’ll give it a go. Thank you!

I am curious how this actually works, can you explain how scope binding would bind to a key?

From Github source, there is a prototype bind method (source) which calls _bindMultiple which in turn calls _bindSingle functions. I think this is how scope binding binds to the key pressed.