forked from breatheco-de/exercise-unit-test-with-jest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
54 lines (40 loc) · 1.5 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// One euro is:
let oneEuroIs = {
"JPY": 156.5, // japan yen
"USD": 1.07, // us dollar
"GBP": 0.87, // british pound
}
// Declaramos una función con el nombre exacto "formEuroToDollar"
const fromEuroToDollar = function(valueInEuro) {
// Convertimos el valor a dólares
let valueInDollar = valueInEuro * 1.07;
// Retornamos el valor en dólares
return valueInDollar;
}
// Declaramos una función con el nombre "fromDollarToYen "
const fromDollarToYen = function(AmountInDollar) {
// Convertimos el valor a euros
let amountInEuro = AmountInDollar / oneEuroIs["USD"];
// Convertir de euros a yenes japoneses
let AmountInYen = amountInEuro * oneEuroIs["JPY"];
return AmountInYen;
}
// Declaramos una función con el nombre "fromYenToPound"
const fromYenToPound = function(ValueInYens){
// Convertimos el valor a euros
let AmountInEuro = ValueInYens / oneEuroIs["JPY"];
// Convertir de euros a pounds
let ValueInPound = AmountInEuro * oneEuroIs["GBP"];
return ValueInPound;
}
console.log(fromDollarToYen(100)); // Salida esperada: aproximadamente 11682.24
console.log(fromYenToPound(100)); // Salida esperada: apro
// This is my function that sums two numbers
const sum = (a,b) => {
return a + b
}
// Just a console log for ourselves
console.log(sum(7,3))
// Export the function to be used on other files
// (similar to the keyword "export" when using webpack)
module.exports = { sum, fromEuroToDollar, fromDollarToYen, fromYenToPound}