I have an function with an if statement that says:
function reflect() {
if (number_a >= 600) {
ball_velocity_a = -ball_velocity_a }
if (number_b >= 600) {
ball_velocity_b = -ball_velocity_b
}}
and I'm trying to convert this function into arrow function
const deflect = () => number_a >= 600 ? ball_velocity_a = -ball_velocity_a :
but I'm not sure what to put after the :
as ball_velocity_b
is conditioned with number_b
instead of number_a
. I'm really new to arrow functions and would appreciate some help on this.
Aucun commentaire:
Enregistrer un commentaire