- 2
Currency converter, can you point out errors?
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(a;b){ return = a*b; console.log(convert (100;1.1)) }
3 Respostas
+ 3
Alim Niyazov , first you don't need to print with specific values =>console.log(convert(100, 1.1). Replace semicolons with commas between the function parameters and arguments. You can't say return = a * b. Instead write return a * b
try this way :
function main() {
var amount = parseFloat(readLine(), 10);
var rate = parseFloat(readLine(), 10);
console.log(convert(amount, rate));
}
function convert(a,b){
return a*b;
}
+ 7
Rewrite the convert function like :
function convert(a,b)
{
return a*b ;
}
0
thank you very much for making such stupid mistakes