<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JavaScript</title>
</head>
<body>
<!-- <p id="test"></p> //#1 -->
<canvas height="100" width="300" style="border: 2px blue double;">
</canvas>
<script type="text/javascript">
// window.alert("Hello There"); //worked
// document.write("Hello There"); //worked
// document.getElementById("test") .innerHTML = "Hello There"; //#1
// console.log("Hello there Help me im so alone"); //worked
/*function ifCommand() {
var x = 10;
if (x < 100){
window.alert(" X smaller then 100");
}
}*/ //#2
/*function elseIfCommand() {
var x = 15;
if (x < 10) {
window.alert("x smal than 10");
}
else if (x < 20) {
window.alert("x smal than 20 and bigger than 10");
}
}*/
var kanvas = document.querySelector("canvas");
var konteks = kanvas.getContext("2d");
konteks.moveTo(10,10);
konteks.lineTo(290,40);
konteks.stroke();
var konteks2 = kanvas.getContext("2d");
konteks2.moveTo(10,40);
konteks2.lineTo(290,10);
konteks2.stroke();
</script>
</body>
</html>Bu şekilde deneyin, javascript kod bloğunu önce değil sonra çağırın.