vendredi 10 août 2018

Javascript function on numbers divisible by 4 or 6

Write a function called redskin that has a single parameter called number. number will be a positive integer. If number is divisible by 4 return the string 'Red' If number is divisible by 6 return the string 'Skins' If number is divisible by 4 AND 6 return the string 'Red Skins' (notice the space) If number is NOT divisible by 4 or 6 then return number.

I know how to write the first two if statements, but am stumped on the last two to write. Any ideas or suggestions?

Aucun commentaire:

Enregistrer un commentaire