 // JavaScript Olympics

// I paired [with: Jones] on this challenge.

// This challenge took me [#] hours.


// Release 1
var addEvents = function(athletes) {
  for (var i = 0; i < athletes.length; i++) {
    athletes[i].win = athletes[i].name + " won the " + athletes[i].event;
  }
console.log(athletes);
}


// Releaes 2
var revString = function(string) {
  var revArray = [];
  revArray = string.split("");
  revArray.reverse();
  var solution = revArray.join("");
  return solution;
}


//Release 2 - Refactor
var revString = function(string) {
  var reversedString = "";
  for (var i = string.length; i >= 0; i--) {
    reversedString += string.charAt(i);
  } // end for
  console.log(reversedString);
}


// Release 3
var evens = function(array){
  var solution = [];
  for (var i = 0; i < array.length; i++) {
    if (array[i] % 2 === 0) {
      solution.push(array[i]);
    }
  } // end for
  return solution;
}


// Release 4
function Athlete(name, age, sport, quote) {
  this.name = name;
  this.age = age;
  this.sport = sport;
  this.quote = quote;
}



// Reflection

1.  What JavaScript knowledge did you solidify in this challenge??

  I think that my pair and I can both vouch for the fact that we learned that it is
  incredibly easy to forget to put in the keyword var, to declare a variable. Also, we
  learned that we need to use this keyboard to declare our init value in our for loops.

2.  What are constructor functions?

  Constructor functions remind me quite a lot of what making a "class" is in Ruby. Code within a
  function is intended to be reused multiple times. Before it can be used, it must first be
  instantiated and perhaps given some arguements when this is done (just like a ruby class). Once
  an instance is created using:
   var newInstance = new functionName();
 then newIntance will have the properties defined in the the contructor function. (assuming it w
  as given some).

3. How are constructors different from Ruby classes (in your research)?

  My research seems to show that ruby classes DO very simliar things to JS constructors,
  however the way they do it is different. In Ruby, instances of classes are used to make new
  objects. In JS, a constructor is an object that is invoked to make a new object. However, one
  big difference is that a constructor function cannot build a function that is available to all
  instances of itself like ruby can. This can be done using the prototype function in JS.

  W3schools explains this in a very simple way. "Every JavaScript object has a prototype. The pr
  ototype is also and object. All Javascript objects inherit their properties and methods from their
  prototype."

  I am not entirely clear on this, but it seems like the .prototype function is used to add properties
  and functions to existing constructors. However, I don't see why you can't just add the function into
  the constructor everytime you need a new function added to a contructor!

@@ -1075,16 +1075,19 @@
 ection%0A%0A
+// 
 1.  What
@@ -1146,16 +1146,19 @@
 enge??%0A%0A
+// 
   I thin
@@ -1233,16 +1233,19 @@
 t it is%0A
+// 
   incred
@@ -1323,16 +1323,19 @@
 lso, we%0A
+// 
   learne
@@ -1415,16 +1415,19 @@
 loops.%0A%0A
+// 
 2.  What
@@ -1455,16 +1455,19 @@
 tions?%0A%0A
+// 
   Constr
@@ -1555,16 +1555,19 @@
 ithin a%0A
+// 
   functi
@@ -1650,18 +1650,21 @@
 irst be%0A
+//
   
+ 
 instanti
@@ -1751,16 +1751,19 @@
 ). Once%0A
+// 
   an ins
@@ -1786,16 +1786,19 @@
  using:%0A
+// 
    var n
@@ -1830,16 +1830,19 @@
 Name();%0A
+// 
  then ne
@@ -1930,16 +1930,19 @@
 ng it w%0A
+// 
   as giv
@@ -1952,16 +1952,19 @@
 some).%0A%0A
+// 
 3. How a
@@ -2028,16 +2028,19 @@
 arch)?%0A%0A
+// 
   My res
@@ -2120,16 +2120,19 @@
 uctors,%0A
+// 
   howeve
@@ -2217,16 +2217,19 @@
 ake new%0A
+// 
   object
@@ -2316,18 +2316,21 @@
 er, one%0A
+//
   
+ 
 big diff
@@ -2416,16 +2416,19 @@
  to all%0A
+// 
   instan
@@ -2510,16 +2510,19 @@
 in JS.%0A%0A
+// 
   W3scho
@@ -2610,18 +2610,21 @@
  The pr%0A
+//
   
+ 
 ototype 
@@ -2714,16 +2714,19 @@
 m their%0A
+// 
   protot
@@ -2732,16 +2732,19 @@
 type.%22%0A%0A
+// 
   I am n
@@ -2838,18 +2838,21 @@
 perties%0A
+//
   
+ 
 and func
@@ -2945,16 +2945,19 @@
 on into%0A
+// 
   the co

Comment out reflection