1
Write a function with the name coinConverter
that converts the value of dollars to real, Mexican pesos and Chilean pesos.
Use the following exchange rates:
reais = dólares * 3.25 //
pesosMexicanos = dólares * 18 // pesosChilenos = dólares * 660
Code:
module.exports = function coinConvert(usDollars) {
var arr = [];
var reais = [usDollars * 3.25];
var mexicanPesos = [usDollars * 18];
var chileanPesos = [usDollars * 660];
// Adicione o valor equivalente em reais
arr.push(50*3.25);
// Adicione o valor equivalente em pesos mexicanos
arr.push(50*18);
// Adicione o valor equivalente em pesos chilenos
arr.push(50*660);
return arr;
};
I put the data and only one gets Ok... And this error appears:
coinConvert()
- should return
[162.5, 900, 33000]
, for$50
, okay - should return
[325, 1800, 66000]
, for$100
- expected
[ 162.5, 900, 33000 ]
to Deeply Equal[ 325, 1800, 66000 ]
- should return
[243.75, 1350, 49500]
, for$85
- expected
[ 162.5, 900, 33000 ]
to Deeply Equal[ 276.25, 1530, 56100 ]
Hello @Jeh, note in your code that the value "50" is fixed when running the
array.push()
, i.e., Voce must change the value "50" according to the variables created above. You created 3 (real, mexicanPesos and chileanPesos), only you did nothing with them.– Douglas Garrido
But how do I do it?
– Jeh