You are on page 1of 1

Javascript Homework

1. Given an array of integer numbers, compute how many values from the
array are odd and how many of them are even.

var mac = {even:[], odd:[]};


[1, 3, 5, 6, 8, 9].forEach(function(val,key,arr)
{
var pac = (val % 2) ? 'odd' : 'even';
mac[pac][mac[pac].length] = val;
});
console.log(mac);

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. 

var newStr = ["Am", "terminat"].join(" ");


console.log(newStr.toUpperCase());

You might also like