IMPORTANT: This is a homework assignment, so I am not looking for someone to write my code, just looking for guidance on structure.
My JavaScript table generates exactly as I want, but my code is missing the return value and is therefore giving me an undefined comment in addition to the table. I have tried nesting it all within another function, which I assign to the return value, but no change.
My JavaScript table generates exactly as I want, but my code is missing the return value and is therefore giving me an undefined comment in addition to the table. I have tried nesting it all within another function, which I assign to the return value, but no change.
Code:
function Trig() {
var d, x, decSin, decCos;
d = 0; // radians
while (d <= 360)
{
x = Math.PI/180*(d);
decSin = Math.sin(x);
decCos = Math.cos(x); //
document.write("<tr><td>" + d + "</td><td>" + decSin + "</td><td>" + decCos + "</td></tr>");
d = d+15;
}
}
Comment