dimanche 3 mai 2020

undefiend is returned in the return value of Console log

I have a program that changes the string depending on the number that comes in like this, but it returns "undefined" for the value... What is the cause of this?

Again, I don't know what the solution is and I need your help.

function size(num){
   if (num >= 1000) {
       console.log('a')
   } else if(num >= 500) {
       console.log('b')
   } else if(num >= 300) {
       console.log('c')
   } else {
       console.log('d')
   }
}
console.log(size(100));

Aucun commentaire:

Enregistrer un commentaire