everything is ready except OOP
This commit is contained in:
@@ -109,13 +109,17 @@
|
||||
],
|
||||
"challengeSeed":[
|
||||
"var Car = function() {",
|
||||
" this.gear = 1;",
|
||||
"",
|
||||
" gear = 1;",
|
||||
"",
|
||||
" function addStyle(styleMe){",
|
||||
" return 'The Current Gear Is: ' + styleMe;",
|
||||
" }",
|
||||
"",
|
||||
" this.getGear = function() {",
|
||||
" return addStyle(this.gear);",
|
||||
" };",
|
||||
"",
|
||||
"};",
|
||||
"",
|
||||
"var Bike = function() {",
|
||||
@@ -123,10 +127,11 @@
|
||||
" // Only change code below this line.",
|
||||
"",
|
||||
" this.speed = 100;",
|
||||
"",
|
||||
" function addUnit(value) {",
|
||||
" return value + \"KM/H\";",
|
||||
" }",
|
||||
" ",
|
||||
"",
|
||||
" getSpeed = function () {",
|
||||
" return addUnit(speed);",
|
||||
" };",
|
||||
@@ -203,6 +208,9 @@
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"(function() {return array;})();"
|
||||
@@ -221,7 +229,7 @@
|
||||
"To use <code>reduce</code> you pass in a callback whose arguments are an accumulator (in this case, <code>previousVal</code>) and the current value (<code>currentVal</code>).",
|
||||
"<code>reduce</code> has an optional second argument which can be used to set the initial value of the accumulator. If no initial value is specified if will be the first array element.",
|
||||
"Here is an example of <code>reduce</code> being used to sum all the values of an array:",
|
||||
"<code>var singleVal = array.reduce(function(previousVal, currentVal){</code>",
|
||||
"<code>var singleVal = array.reduce(function(previousVal, currentVal) {</code>",
|
||||
"<code>  return previousVal+currentVal;</code>",
|
||||
"<code>});</code>",
|
||||
"Use the <code>reduce</code> method to sum all the values in <code>array</code> and assign it to <code>singleVal</code>."
|
||||
@@ -239,6 +247,9 @@
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"// Only change code above this line.",
|
||||
"",
|
||||
"(function() {return singleVal;})();"
|
||||
|
Reference in New Issue
Block a user