@@ -8,14 +8,14 @@ test("defining functions directly", function() {
88 result = "b" ;
99 } ;
1010 changeResult ( ) ;
11- equals ( result , __ , 'what is the value of result?' ) ;
11+ equals ( result , "b" , 'what is the value of result?' ) ;
1212} ) ;
1313
1414test ( "assigning functions to variables" , function ( ) {
1515 var triple = function ( input ) {
1616 return input * 3 ;
1717 } ;
18- equals ( triple ( 4 ) , __ , 'what is triple 4?' ) ;
18+ equals ( triple ( 4 ) , 12 , 'what is triple 4?' ) ;
1919} ) ;
2020
2121test ( "self invoking functions" , function ( ) {
@@ -24,22 +24,22 @@ test("self invoking functions", function() {
2424 // self invoking functions are used to provide scoping and to alias variables
2525 ( function ( pv ) {
2626 var secretValue = "password" ;
27- equals ( pv , __ , 'what is the value of pv?' ) ;
28- equals ( typeof ( secretValue ) , "__ " , "is secretValue available in this context?" ) ;
29- equals ( typeof ( publicValue ) , "__ " , "is publicValue available in this context?" ) ;
27+ equals ( pv , "shared" , 'what is the value of pv?' ) ;
28+ equals ( typeof ( secretValue ) , "string " , "is secretValue available in this context?" ) ;
29+ equals ( typeof ( publicValue ) , "string " , "is publicValue available in this context?" ) ;
3030 } ) ( publicValue ) ;
3131
32- equals ( typeof ( secretValue ) , "__ " , "is secretValue available in this context?" ) ;
33- equals ( typeof ( publicValue ) , "__ " , "is publicValue available in this context?" ) ;
32+ equals ( typeof ( secretValue ) , "undefined " , "is secretValue available in this context?" ) ;
33+ equals ( typeof ( publicValue ) , "string " , "is publicValue available in this context?" ) ;
3434} ) ;
3535
3636test ( "arguments array" , function ( ) {
3737 var add = function ( ) {
3838 var total = 0 ;
3939 for ( var i = 0 ; i < arguments . length ; i ++ ) {
40- // complete the implementation of this method so that it returns the sum of its arguments
40+ total += arguments [ i ] ;
4141 }
42- // __
42+ return total ;
4343 } ;
4444
4545 equals ( add ( 1 , 2 , 3 , 4 , 5 ) , 15 , "add 1,2,3,4,5" ) ;
@@ -57,7 +57,7 @@ test("using call to invoke function",function(){
5757 //function, and the arguments to be sent to the function,multiple arguments are separated by commas.
5858 var result = invokee . call ( "I am this!" , "Where did it come from?" ) ;
5959
60- equals ( result , __ , "what will the value of invokee's this be?" ) ;
60+ equals ( result , "I am this!Where did it come from?" , "what will the value of invokee's this be?" ) ;
6161} ) ;
6262
6363test ( "using apply to invoke function" , function ( ) {
@@ -70,6 +70,6 @@ test("using apply to invoke function",function(){
7070 //function and and array of arguments to be passed into the called function.
7171 var result = invokee . apply ( "I am this!" , [ "I am arg1" , "I am arg2" ] ) ;
7272
73- equals ( result , __ , "what will the value of invokee's this be?" ) ;
73+ equals ( result , "I am this!I am arg1I am arg2" , "what will the value of invokee's this be?" ) ;
7474} ) ;
7575
0 commit comments