@@ -2,34 +2,35 @@ 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 ( 'object' , 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+ ok ( daysOfWeek . equalTo ( [ 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' , 'Saturday' , 'Sunday' ] ) , '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+
2425} ) ;
2526
2627test ( "stack methods" , function ( ) {
2728 var stack = [ ] ;
2829 stack . push ( "first" ) ;
2930 stack . push ( "second" ) ;
3031
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?' ) ;
32+ equal ( 'second' , stack . pop ( ) , 'what will be the first value popped off the stack?' ) ;
33+ equal ( 'first' , stack . pop ( ) , 'what will be the second value popped off the stack?' ) ;
3334} ) ;
3435
3536test ( "queue methods" , function ( ) {
@@ -38,6 +39,6 @@ test("queue methods", function() {
3839 queue . push ( "second" ) ;
3940 queue . unshift ( "third" ) ;
4041
41- equal ( __ , queue . shift ( ) , 'what will be shifted out first?' ) ;
42- equal ( __ , queue . shift ( ) , 'what will be shifted out second?' ) ;
42+ equal ( 'third' , queue . shift ( ) , 'what will be shifted out first?' ) ;
43+ equal ( 'first' , queue . shift ( ) , 'what will be shifted out second?' ) ;
4344} ) ;
0 commit comments