Compare each value between two arrays. #hackerrank #warmup
/*
Solution for HackerRank > Algorithms > Warmup > Compare the Triplets
https://www.hackerrank.com/challenges/compare-the-triplets
*/
function main() {
var A = [5,6,7];
var B = [3,6,10];
// Set counters to '0'
var alice = 0, bob = 0;
// Test each array and award a point to the array with the great value
for (var i = 0; i < A.length; i++){
if (A[i] > B[i]){
alice += 1;
} else if (A[i] < B[i]){
bob += 1;
}
}
// Log the points for each array
console.log(alice + ' ' + bob);
}
main();