+ 5
I need help with JavaScript currency converter problem
I don’t know what to do to complete this problem function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } Can anyone help me plz
10 Réponses
+ 14
Here is my solution:
function main() {
var amount = parseFloat(readLine(), 10);
var rate = parseFloat(readLine(), 10);
function convert (a,b){
var c = a * b;
return c
}
console.log(convert(amount, rate));
}
+ 2
convert (42,0.72)
function convert(amount,rate){
console.log (amount*rate);
}
I don’t know how to add diffren amount and rate
to fix this problem?
+ 2
Hi all !
I have difficulties to achieve this practise.
This is my code and I can't see what is wrong.
I have the error "NaN" in every test cases...
function main() {
var amount = parseFloat(readLine(), 10);
var rate = parseFloat(readLine(), 10);
function convert(montant, taux) {
var nvxMontant = montant * taux;
return nvxMontant;
}
console.log(convert(amount, rate));
}
main();
Could someone help me please ?
+ 1
Saif Aljubori
function convert(amount,rate){
var total = amount* rate ;
return total;
}
+ 1
function main() {
var amount = parseFloat(readLine(), 10);
var rate = parseFloat(readLine(), 10);
console.log(convert(amount, rate));
function convert(){
amount => amount;
rate => rate;
return amount*rate;
}
convert();
}
+ 1
Roman Vasylyna
Don't call main function
Code is running on Node server so no need to call main function
0
Saif Aljubori Where is your attempts?
To solve the problem go through the lessons again.
0
Function convert(a,b){
Var c=a*b;
Return c;
}
Console.log(convert(amount,rate));
0
For some reason I am having NaN error even though the solution is correct
function main() {
var amount = parseFloat(readLine(), 10);
var rate = parseFloat(readLine(), 10);
console.log(convert(amount, rate));
}
function convert(a, b) {
return a*b;
}
main();
0
Give that
function main () {
Var amount = parseFloat(readLine(), 10);
Var rate = parseFloat(readLine(), 10);
Use to function
Function convert (amount, rate){
return amount*rate;
}
Console.log(convert (amount,rate));
}