Hi Mike, The top part of the code defines the function, but the variable names are for its internal use, not yours. Perhaps I should have used demonstration arguments with different names than those being passed. In practice, you'd put the function inside a systemConfig tiddler and then invoke it when you need it. In your example, the last line should invoke the function like:
wikify(ArraySubtract(ara1,ara2)+' (aRes)' +'\n' ,place); or changing the last lines entirely to make the principle clear: var myAra1 = ['a','b','c','d','e']; var myAra2 = ['c','e']; var myArrayDifference = ArraySubtract(myAra1,myAra2) ; wikify(myAra1+' (My Array 1)'+'\n' ,place); wikify(myAra2+' (My Array 2)' +'\n' ,place); wikify(myArrayDifference +' (Array Difference)' +'\n' ,place); which yields: a,b,c,d,e (My Array 1) c,e (My Array 2) a,b,d (Array Difference) HTH Mark On Apr 27, 5:45 am, Mike <[email protected]> wrote: > I think I am missing something (thank you in advance for your > patience) > > My Attempt: > <script> > var ara1 = ['a','b','c','d','e']; > var ara2 = ['c','e']; > > function ArraySubtract(ara1,ara2) { > var aRes = new Array() ; > for(var i=0;i<ara1.length;i++) { > if( ! (ara2.contains(ara1[i]) )) { > aRes.push(ara1[i]) ; > } > } > return aRes ; > > } > > wikify(ara1+' (ara1)'+'\n' ,place); > wikify(ara2+' (ara2)' +'\n' ,place); > wikify(aRes+' (aRes)' +'\n' ,place); > </script> > > Results: (wikify x3 to separate results / error) > a,b,c,d,e (ara1) > c,e (ara2) > ReferenceError: aRes is not defined > > Did I miss something? / Wrong usage? > > Mike > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWiki" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/tiddlywiki?hl=en. -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.

