I think you are better off thinking in regular scala for this one.
In particular, if you are relying on the cast of 0 to a boolean, this is a bad practice, not per se, but because you rely on implicit casting as rarely as possible and preferably when it does not change the semantic type.
I would rewrite your assignment in a more expressive way
var scrollPosition =
if (window.pageYoffset > 0) {
window.pageYoffset
} else if (document.documentElement.scrollTop > 0) {
document.documentElement.scrollTop
} else if (document.body.scrollTop > 0) {
document.body.scrollTop
} else {
0
}
I can make it even more expressive using a match case or by giving a meaning to
intermediate steps.