trying to be more efficient with JavaScript through kata.