@@ -2,34 +2,34 @@ module("About Arrays (topics/about_arrays.js)");
22
33test ( "array literal syntax and indexing" , function ( ) {
44 var favouriteThings = [ "cellar door" , 42 , true ] ; // note that array elements do not have to be of the same type
5- equal ( __ , favouriteThings [ 0 ] , 'what is in the first position of the array?' ) ;
6- equal ( __ , favouriteThings [ 1 ] , 'what is in the second position of the array?' ) ;
7- equal ( __ , favouriteThings [ 2 ] , 'what is in the third position of the array?' ) ;
5+ equal ( cellar door , favouriteThings [ 0 ] , 'what is in the first position of the array?' ) ;
6+ equal ( 42 , favouriteThings [ 1 ] , 'what is in the second position of the array?' ) ;
7+ equal ( true , favouriteThings [ 2 ] , 'what is in the third position of the array?' ) ;
88} ) ;
99
1010test ( "array type" , function ( ) {
11- equal ( __ , typeof ( [ ] ) , 'what is the type of an array?' ) ;
11+ equal ( string , typeof ( [ ] ) , 'what is the type of an array?' ) ;
1212} ) ;
1313
1414test ( "length" , function ( ) {
1515 var collection = [ 'a' , 'b' , 'c' ] ;
16- equal ( __ , collection . length , 'what is the length of the collection array?' ) ;
16+ equal ( 3 , collection . length , 'what is the length of the collection array?' ) ;
1717} ) ;
1818
1919test ( "splice" , function ( ) {
2020 var daysOfWeek = [ 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' , 'Saturday' , 'Sunday' ] ;
21- var workingWeek = daysOfWeek . splice ( __ , __ ) ;
22- ok ( workingWeek . equalTo ( [ __ ] ) , 'what is the value of workingWeek?' ) ;
23- ok ( daysOfWeek . equalTo ( [ __ ] ) , 'what is the value of daysOfWeek?' ) ;
21+ var workingWeek = daysOfWeek . splice ( 0 , 5 ) ;
22+ ok ( workiingWeek . equalTo ( [ 4 ] ) , 'what is the value of workingWeek?' ) ;
23+ ok ( daysOfWeek . equalTo ( [ 6 ] ) , 'what is the value of daysOfWeek?' ) ;
2424} ) ;
2525
2626test ( "stack methods" , function ( ) {
2727 var stack = [ ] ;
2828 stack . push ( "first" ) ;
2929 stack . push ( "second" ) ;
3030
31- equal ( __ , stack . pop ( ) , 'what will be the first value popped off the stack?' ) ;
32- equal ( __ , stack . pop ( ) , 'what will be the second value popped off the stack?' ) ;
31+ equal ( "second" , stack . pop ( ) , 'what will be the first value popped off the stack?' ) ;
32+ equal ( "first" , stack . pop ( ) , 'what will be the second value popped off the stack?' ) ;
3333} ) ;
3434
3535test ( "queue methods" , function ( ) {
@@ -38,6 +38,6 @@ test("queue methods", function() {
3838 queue . push ( "second" ) ;
3939 queue . unshift ( "third" ) ;
4040
41- equal ( __ , queue . shift ( ) , 'what will be shifted out first?' ) ;
42- equal ( __ , queue . shift ( ) , 'what will be shifted out second?' ) ;
41+ equal ( "third" , queue . shift ( ) , 'what will be shifted out first?' ) ;
42+ equal ( "first" , queue . shift ( ) , 'what will be shifted out second?' ) ;
4343} ) ;
0 commit comments