function multNmbrs(a, b) { var c = a*b; } multNmbrs(2, 6); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

function multNmbrs(a, b) { var c = a*b; } multNmbrs(2, 6);

hello all! can someone explain to me, why this code gives nothing?

30th Aug 2019, 7:26 PM
Basem Kreidly
Basem Kreidly - avatar
5 Answers
+ 6
First of all you are not doing anything like console.log and second is you are returning nothing out of this function, And if you are just trying to find the multiplication of these numbers there is no need of declaration of variable c inside your function you can just put return a*b And here is a improved version of your code function multNmbrs(a,b){ return a*b; } console.log(multNmbrs (2,6));
31st Aug 2019, 3:27 AM
Bug Slayer
+ 1
answer is nothing
22nd Apr 2021, 2:49 AM
March Virnel M. Satera
March Virnel M. Satera - avatar
+ 1
nothing
5th Dec 2021, 6:42 PM
Medhat Mohamed Ibrahim Abu Mandour
Medhat Mohamed Ibrahim Abu Mandour - avatar
+ 1
nothing
3rd Jun 2022, 10:29 AM
ERICK KIMUTAI KORIR
0
The answer is nothing, because it is not returning anything.
1st Apr 2023, 10:13 AM
Arpita Karmakar
Arpita Karmakar - avatar