can we do this in pure js?