не рисуется в canvas ничего JS
не понимаю почему не хочет по клику ничего рисовать. формулу выводит, а именно рисовать не хочет.
function main() {
let x, c, y;
let step = document.forms.get.inputstep.value;
let end = document.forms.get.inputend.value;
let start = document.forms.get.inputstart.value;
start = Number(start);
end = Number(end);
step = Number(step);
c = Number(start);
for (var item = start; item <= end; item = item + step) {
start = item + start;
x = item;
y = (0.3 * Math.pow(Math.E, x + Math.pow(x, 0.5))); //0.3 e^ (x + x^0.5)
}
console.log("Цикл For->" + y);
start = c;
while (start < end) {
x = start;
y = (0.3 * Math.pow(Math.E, x + Math.pow(x, 0.5)));
start = step + start;
}
alert("Цикл While->" + y)
start = c;
do {
x = start;
y = (0.3 * Math.pow(Math.E, x + Math.pow(x, 0.5)));
start = step + start;
}
while (start <= end);
console.log("Do while->" + y);
}
function draw() {
var c = document.getElementById("Canvas");
var ctx = c.getContext("2d");
var start = document.getElementById("inputstart");
var step = document.getElementById("inputstep");
var end = document.getElementById("inputend");
var y, x, c;
ctx.strokeStyle = 'aqua';
start = Number(start);
end = Number(end);
step = Number(step);
ctx.lineWidth = 5;
ctx.beginPath();
ctx.moveTo(0, 0);
for (var i = start; i <= end; i = i + step) {
start = i + start;
x = i;
y = (0.3 * Math.pow(Math.E, x + Math.pow(x, 0.5)));
ctx.lineTo(x, y);
}
ctx.stroke();
}
console.log(draw, main, );
<form id="get">
Input Start<input name="inputstart" id="inputstart"> Input End<input name="inputend" id="inputend"> Input Step<input name="inputstep" id="inputstep">
</form>
<button onClick=draw()>Drawing</button>
<button onClick=main()>Forms</button><br/>
<canvas id="Canvas" width="500px" height="500px"></canvas>