diff --git a/01-greeting/index.js b/01-greeting/index.js index 8f551af..c1211f1 100644 --- a/01-greeting/index.js +++ b/01-greeting/index.js @@ -1,4 +1,4 @@ export function greet(name) { // implementar logica aqui - return ""; + return "Hello " + name; } diff --git a/02-triangleArea/index.js b/02-triangleArea/index.js index 7628fcd..07023c6 100644 --- a/02-triangleArea/index.js +++ b/02-triangleArea/index.js @@ -1,3 +1,4 @@ export function triangleArea(base, height) { - // your code here + + return(base * height) /2; } \ No newline at end of file diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..0a6707d 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,17 @@ export function maxValue(values) { - // implementar logica aqui - -} \ No newline at end of file + + const values = [4, 6, 12, 5]; + const values = [9, 234, 312, 999, 21, 2311]; + const values = [533, 234, 23423, 32, 432]; + const values = [5, 4, 3, 2, 1]; + const values = [-1, -5, -10, -45]; + const values = []; + + const maxValue = values.reduce(function(prev, current) { + return prev > current ? prev : current; + }); + return Math.max(values); + +} + + diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..e533dae 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,4 @@ export function isPrime(value) { - // implementar logica aqui + } \ No newline at end of file diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..67c25f2 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,8 @@ export function sum(values) { - // implementar logica aqui - + var sum = 0; + + for(var i = 0; i < values.length; i++) { + sum += values[i]; + } + return sum } \ No newline at end of file