Professional Documents
Culture Documents
JS Tema
JS Tema
Given an array of integer numbers, compute how many values from the array are odd
and how many of them are even.
Odd values: 3
Even values: 2
Hint: Use the example that we did in the class, with calculating the maximum number
from a given array. Use two variables for storing the output results (e.g.
odd_values, even_values)
<script>
function tema(sir){
var even = 0;
var odd = 0;
}
document.write("Total even numbers:" + even, "; ", "Total odd numbers:" + odd);
}
document.write(tema([1,2,3,10,11,12,13,14,16]));
</script>
2. Write a function that will take two strings as parameters and will return their
concatenation, with a space between it, all in upper case.
E.g. calling the function for strings: "happy" and "testing" will return "HAPPY
TESTING"
<script>
function tema2(a, b){
var c = a + " " + b;
return c.toUpperCase()
}
document.write(tema2("happy", "testing"));
</script>