I am new at coding and would like to know if the following is correct:
I want to be able to list information repeatedly with the same text added to
it.
Don't know if this is the way to do it, but it prints out OK for me.
Now, in order to get the items listed vertically, I used the 'join' Method
with <br>; is this correct?
The only problem is there is no text after the last value("g"), so I
inserted empty "" marks as the last value.
Is there a better way to do this, w/o the empty value at the end?
Code:
<html>
<body>
<!-- saved from url=(0014)about:internet -->
<script language="JavaScript" type="text/javascript">
var alphabet = new Array("a","b","c","d","e","f","g","");
var Alphabet = alphabet.join(" is a letter of the alphabet.<br>");
document.write(Alphabet);
</script>
</body>
</html>
Mick White - 30 Apr 2005 21:46 GMT
> I am new at coding and would like to know if the following is correct:
>
[quoted text clipped - 8 lines]
>
> Code:
<script type="text/javascript">
document.write(["a","b","c","d","e","f","g"].join
(" is a letter of the alphabet.<br>")+"<BR>")
</script>
Mick
> <html>
> <body>
[quoted text clipped - 8 lines]
> </body>
> </html>
Evertjan. - 30 Apr 2005 21:55 GMT
ommadawn wrote on 30 apr 2005 in comp.lang.javascript:
> I am new at coding and would like to know if the following is correct:
>
[quoted text clipped - 13 lines]
> <!-- saved from url=(0014)about:internet -->
> <script language="JavaScript" type="text/javascript">
language="JavaScript" has been deprecated for years.
> var alphabet = new Array("a","b","c","d","e","f","g","");
> var Alphabet = alphabet.join(" is a letter of the alphabet.<br>");
[quoted text clipped - 3 lines]
> </body>
> </html>
Are you happy with the result? Then why change it?
> Is there a better way to do this, w/o the empty value at the end?
"Better" is in the hand of the beholder.
<script type="text/javascript">
var tx = ' is a letter of the alphabet.<br>';
var result = 'abcdefg'.split('').join(tx)+tx;
document.write(result)
</script>

Signature
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)