benmcmahon100 2015-08-06 14:54:44 +01:00
parent a82265e883
commit 7284bbf7a7

View File

@ -573,12 +573,12 @@
"difficulty": "9.9817",
"description": [
"Another common way in which we can manipulate the data in an array is through <code>.shift() </code>",
"<code>.shift()</code>is used to \"shift\" a value from the start of an array. We can retrieve this value by preforming the shift in a variable declaration.",
"<code>.shift()</code>is used to \"shift\" a value from the start of an array. We can retrieve this value by performing the shift in a variable declaration.",
"Let's try <code>.shift()</code>now"
],
"tests": [
"assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');",
"assert((function(d){if(d === 'John' && typeof(removed) === 'function'){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');"
"assert((function(d){if(d === 'John' && typeof(removed) === 'string'){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');"
],
"challengeSeed": [
"var myArray = ['John', 23, ['dog', 3]];",