my code just stops

G

greenflame

I have a script and I ran it and it just seems to stop. The reason I
say so is that the script does not get to the second alert. OK here it
is:

function show(input) {
if (input.length == 1) {
for (i=0;i<input[0].length;i++) {
document.write(input[0]);
}
document.write("<br>");
} else {
for (i=0;i<input.length;i++) {
for (j=0;j<input[0].length;j++) {
document.write(input[j]);
}
document.write("<br>");
}
}
}
function squareroot(input) {
output = copy2darr(input);
alert(output.join("\n"));
top = new Array(output[0].length);
alert(output.join("\n")); // This is the alert it never gets to
for (var i=0;i<output[0].length;i++) {
top = "—";
}
alert(top);
n = output.unshift(top);
alert(output.join("\n"));
for (var i=0;i<output.length;i++) {
if (i == 0) {
n = output.unshift("┌");
} else {
n = output.unshift("│");
}
}
for (var i=0;i<output.length;i++) {
if (i != output.length-1) {
n = output.unshift(" ");
} else {
n = output.unshift("\\");
}
}
return output;
}
document.write("long hyphen: —<br>leftmost peice:
┌<br>rightmost peice: ┐<br>taller bar: │<br>square
root symbol: √<br><br>");
arr = [
[" ","5"," "," "," "," "],
["x"," "," ","+"," ","x"]];
show(arr);
show(squareroot(arr));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top