'JavaScript loop slider by bind method

I'm trying to make a loop slider and I saw a great solution here: https://stackoverflow.com/a/70340585/18736427

I understand how the function shiftSlides() works here:

function shiftSlides(direction) {
    direction ? currentSlideIndex++ : currentSlideIndex--
    if (currentSlideIndex === lastSlideIndex || currentSlideIndex === 0) readyNextSlide();
    goToSlide(currentSlideIndex);
}

what I don't understand is how he uses the bind method to control the direction? What is the number 1 and 0 means here?

btnRight.addEventListener("click", shiftSlides.bind(null, 1));
btnLeft.addEventListener("click", shiftSlides.bind(null, 0));


Solution 1:[1]

direction just becomes 1 and 0 respectively. They could just as easily be true or false. The bind method just takes a series of arguments and passes them into the function they're bound to producing a new function.

eg:

btnRight.addEventListener("click", shiftSlides.bind(null, true));
btnLeft.addEventListener("click", shiftSlides.bind(null, false));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joshua Wood