What wrong with this code. I am not able to understand | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What wrong with this code. I am not able to understand

function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert(amount, rate); var convert =amount*rate; return convert; convert(amount,rate) console.log(convert(amount,rate) }

17th Dec 2020, 7:47 AM
Vansh Gupta
Vansh Gupta - avatar
10 Antworten
17th Dec 2020, 9:17 AM
Krish
Krish - avatar
+ 1
Vansh Gupta because you are missing curly braces {} for the function
17th Dec 2020, 9:09 AM
Krish
Krish - avatar
+ 1
17th Dec 2020, 9:29 AM
Krish
Krish - avatar
0
I would call the variable convert with a other name for example: let resultConvert = amount*rate;
17th Dec 2020, 8:16 AM
JaScript
JaScript - avatar
0
I Am Groot ! Please solve this So I can get help
17th Dec 2020, 9:16 AM
Vansh Gupta
Vansh Gupta - avatar
17th Dec 2020, 9:23 AM
Vansh Gupta
Vansh Gupta - avatar
0
Krish This is Mwe Please solve
17th Dec 2020, 9:25 AM
Vansh Gupta
Vansh Gupta - avatar
0
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(a,b){ return a*b; }
3rd Apr 2021, 11:06 AM
ANIKET SINGH
ANIKET SINGH - avatar
- 1
Vansh Gupta It's simple. convert is a function which has 2 parameters amount and rate and that function returns the multiplication of the parameters.
17th Dec 2020, 8:54 AM
A͢J
A͢J - avatar