Here is the code snippet I am currently using:
var snap = this.snaps.find((snap) => {
if(pos > snap.min && snap.max > pos){
return snap;
}
})
if(snap !== undefined){
this.scrollTo = snap.down ? snap.max : snap.min;
}else{
this.scrollTo = undefined
}
My goal is to achieve the same functionality without using an if-else statement. I attempted the following code:
this.scrollTo = this.snaps.find((snap) => {
if(pos > snap.min && snap.max > pos){
return snap.down ? snap.max : snap.min;;
}
})
Unfortunately, this alternative approach did not work as expected.