@@ -3,32 +3,33 @@ module("About Arrays (topics/about_arrays.js)");
33
44test ( "array literal syntax and indexing" , function ( ) {
55 var favouriteThings = [ "cellar door" , 42 , true ] ; // note that array elements do not have to be of the same type
6- equals ( favouriteThings [ 0 ] , __ , 'what is in the first position of the array?' ) ;
7- equals ( favouriteThings [ 1 ] , __ , 'what is in the second position of the array?' ) ;
8- equals ( favouriteThings [ 2 ] , __ , 'what is in the third position of the array?' ) ;
6+ equals ( favouriteThings [ 0 ] , "cellar door" , 'what is in the first position of the array?' ) ;
7+ equals ( favouriteThings [ 1 ] , 42 , 'what is in the second position of the array?' ) ;
8+ equals ( favouriteThings [ 2 ] , true , 'what is in the third position of the array?' ) ;
99} ) ;
1010
1111test ( "array type" , function ( ) {
12- equals ( typeof ( [ ] ) , __ , 'what is the type of an array?' ) ;
12+ equals ( typeof ( [ ] ) , "object" , 'what is the type of an array?' ) ;
1313} ) ;
1414
1515test ( "length" , function ( ) {
1616 var collection = [ 'a' , 'b' , 'c' ] ;
17- equals ( collection . length , __ , 'what is the length of the collection array?' ) ;
17+ equals ( collection . length , 3 , 'what is the length of the collection array?' ) ;
1818} ) ;
1919
2020test ( "splice" , function ( ) {
2121 var daysOfWeek = [ 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' , 'Saturday' , 'Sunday' ] ;
22- var workingWeek = daysOfWeek . splice ( __ , __ ) ;
23- ok ( workingWeek . equalTo ( [ __ ] ) , 'what is the value of workingWeek?' ) ;
24- ok ( daysOfWeek . equalTo ( [ __ ] ) , 'what is the value of daysOfWeek?' ) ;
22+ var workingWeek = daysOfWeek . splice ( 0 , 5 ) ;
23+ ok ( workingWeek . equalTo ( [ 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' ] ) , 'what is the value of workingWeek?' ) ;
24+ ok ( daysOfWeek . equalTo ( [ 'Saturday' , 'Sunday' ] ) , 'what is the value of daysOfWeek?' ) ;
25+
2526} ) ;
2627
2728test ( "stack methods" , function ( ) {
2829 var stack = [ ] ;
2930 stack . push ( "first" ) ;
3031 stack . push ( "second" ) ;
3132
32- equals ( stack . pop ( ) , __ , 'what will be the first value popped off the stack?' ) ;
33- equals ( stack . pop ( ) , __ , 'what will be the second value popped off the stack?' ) ;
33+ equals ( stack . pop ( ) , "second" , 'what will be the first value popped off the stack?' ) ;
34+ equals ( stack . pop ( ) , "first" , 'what will be the second value popped off the stack?' ) ;
3435} ) ;
0 commit comments