@@ -18,7 +18,7 @@ $(document).ready(function(){
1818 }
1919 equals ( counter , __ , 'what is the value of counter?' ) ;
2020 } ) ;
21-
21+
2222 test ( "for in" , function ( ) {
2323 // this syntax will be explained in about objects
2424 var person = {
@@ -32,31 +32,47 @@ $(document).ready(function(){
3232 } ;
3333 equals ( result , __ , 'what is the value of result?' ) ;
3434 } ) ;
35-
35+
3636 test ( "ternary operator" , function ( ) {
3737 var fruit = true ? "apple" : "orange" ;
3838 equals ( fruit , __ , 'what is the value of fruit?' ) ;
39-
39+
4040 fruit = false ? "apple" : "orange" ;
41- equals ( fruit , __ , 'now what is the value of fruit?' ) ;
41+ equals ( fruit , __ , 'now what is the value of fruit?' ) ;
4242 } ) ;
43-
43+
4444 test ( "switch" , function ( ) {
4545 var result = 0 ;
4646 switch ( 2 ) {
47- case 1 :
48- result = 1 ;
47+ case 1 :
48+ result = 1 ;
4949 break ;
5050 case 1 + 1 :
5151 result = 2 ;
5252 break ;
5353 }
5454 equals ( result , __ , 'what is the value of result?' ) ;
5555 } ) ;
56-
56+
57+ test ( "switch default case" , function ( ) {
58+ var result = "Pippin" ;
59+ switch ( "m" ) {
60+ case "f" :
61+ result = "Frodo" ;
62+ break ;
63+ case "s" :
64+ result = "Samwise" ;
65+ break ;
66+ default :
67+ result = "Merry" ;
68+ break ;
69+ }
70+ equals ( result , __ , "what is the value of result?');
71+ } ) ;
72+
5773 test ( "null coallescion" , function ( ) {
5874 var result = null || "a value" ;
59- equals ( result , __ , 'what is the value of result?' ) ;
75+ equals ( result , __ , 'what is the value of result?' ) ;
6076 } ) ;
61-
77+
6278} ) ;
0 commit comments