More idiomatic js