View Full Version : Can anyone give me any help with trace tables??

03-21-2005, 03:19 AM

Just wondering if anyone can give me any help on this. I'll be honest, basically it's for an assignment I need to do for tomorrow. Lol, ok I don't really expect any help now. Not something I'd usually do but after having to learn 4 months worth of work in the space of a few days, and actually really getting into it, I'm determined to do my best to try and pass this course. I've managed to do more than 1/2 of it and a few more marks might give me a pass mark. Sorry for rambling, I've been reading codes non stop for the past few days and I can't seem to take anymore informatin in :confused: If anyone can even give me a little bit of help on this I'd really really appreciate it :)

I've got to construct a trace table for the following. No idea really how to do a trace table, can anyone help? Then I've to say what's wrong with it, again I don't have a clue :confused:

newString = '';
for (var index = 0; index < aString.length; index = index + 1)
if (isLowerCase(aString.charAt(index))
newString = newString + aString.charAt(index).toUpperCase()
newString = newString + aString.charAt(index).toLowerCase()
return newString

Trace table is supposed to have 6 lines, as follows

Line,newString,index,index< aString.length,isLowerCase(aString.charAt(index))