N
nightsaber
<script language="JavaScript">
<!-- hide me
var the_number = prompt("how many words (3-5 is good)?", "4");
var the_string = "";
var a_word;
for (loop = 0; loop < the_number; loop++)
{
line_number = loop + 1;
a_word = prompt("what's word " + line_number + "?","");
the_string = "word " + line_number + ": " + a_word + "<br>" +
the_string;
}
var new_window =
window.open("reverse.html","reverse","height=400,width=400");
new_window.document.writeln("<h1>In reverse</h1>");
new_window.document.writeln(the_string);
// show me -->
</script>
ok heres what i DONT get and it kinda screws upo the whole thing for
me.
part and it makes the line number 0 ...i just dont get this at all. i
started on this java tutorial thing today at 7am..... its now 2 45 am
I understand the majority of it up to here....
of course
afformentioned value to itself so the _string DOESNT= "word 1 :
apple"+"word 1 : apple"it just = "word 1 : apple" and whatever the
next word is will be added to that so it will be the_string="word 2
range, word 1 :apple"
any help is appreciated. i like to understand not only HOW but WHY?!
cause i see what it does i just dont know WHY and that bugs the heck
outta me.
<!-- hide me
var the_number = prompt("how many words (3-5 is good)?", "4");
var the_string = "";
var a_word;
for (loop = 0; loop < the_number; loop++)
{
line_number = loop + 1;
a_word = prompt("what's word " + line_number + "?","");
the_string = "word " + line_number + ": " + a_word + "<br>" +
the_string;
}
var new_window =
window.open("reverse.html","reverse","height=400,width=400");
new_window.document.writeln("<h1>In reverse</h1>");
new_window.document.writeln(the_string);
// show me -->
</script>
ok heres what i DONT get and it kinda screws upo the whole thing for
me.
yet thats NOT how it works. it puts the value as 1. take out the +1for (loop = 0; loop < the_number; loop++) ok loop++ means loop = loop +1 so loop is now 1 <0+1=1>
{
line_number = loop + 1; at this point it ADDS 1 to loop which is as i said 1 making "line_number" = 2 <1+1>
part and it makes the line number 0 ...i just dont get this at all. i
started on this java tutorial thing today at 7am..... its now 2 45 am
I understand the majority of it up to here....
of course
but i suppose im being to literal. i am guessing this adds thethe_string = "word " + line_number + ": " + a_word + "<br>" + the_string; kinda throws me it seems like its saying the _string = "word 1 : apple"+"word 1 : apple"
afformentioned value to itself so the _string DOESNT= "word 1 :
apple"+"word 1 : apple"it just = "word 1 : apple" and whatever the
next word is will be added to that so it will be the_string="word 2
range, word 1 :apple"
any help is appreciated. i like to understand not only HOW but WHY?!
cause i see what it does i just dont know WHY and that bugs the heck
outta me.