View Full Version : converting
cturner
10-25-2002, 11:59 AM
How do I convert a number read into asterisks and then display the amount of asterisks in a HTML table?
jalarie
10-25-2002, 02:15 PM
Start with the following and build your table however you wish:
a=prompt('?',0);
b='';
for (i=1; i<=a; i++) {
b=b+'*';
}
alert(b);
ConfusedOfLife
10-25-2002, 02:24 PM
a=prompt('?',0);
b='';
for (i=1; i<=a.length ; i++) {
b+='*';
}
alert(b);
A typo?
jalarie
10-25-2002, 02:27 PM
Nope. The request was to start with a number, so I care about the value of that number rather than its length.
ConfusedOfLife
10-25-2002, 02:36 PM
Ok, but I think it's better that you use parseInt() or RegExp that you check if it's a number entered, huh?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.