'use strict';

var nouns = [
  'cat',
  'dog',
  'mouse',
  'house'
];
var firstNoun = '';
var secondNoun = '';
var metaphor = '';

var numberOfNouns = nouns.length;
var nounIndex1 = 0;
var nounIndex2 = 0;

// Returns a random integer between min (included) and max (excluded)
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min)) + min;
}

function generateMetaphor(nouns) {
  nounIndex1 = getRandomInt(0, numberOfNouns);
  nounIndex2 = getRandomInt(0, numberOfNouns);

  firstNoun = nouns[nounIndex1];
  secondNoun = nouns[nounIndex2];

  metaphor = firstNoun + ' is a ' + secondNoun + '.';
  console.log(metaphor);
}

generateMetaphor(nouns);

@@ -427,16 +427,121 @@
 min;%0A%7D%0A%0A
+function capitalizeFirstLetter(string) %7B%0A    return string.charAt(0).toUpperCase() + string.slice(1);%0A%7D%0A%0A
 function
@@ -567,16 +567,16 @@
 ouns) %7B%0A
-
   nounIn
@@ -672,24 +672,46 @@
 firstNoun = 
+capitalizeFirstLetter(
 nouns%5BnounIn
@@ -715,16 +715,17 @@
 nIndex1%5D
+)
 ;%0A  seco

Capitalize first noun