今日はJavascriptでデバッグ方法を紹介する。
alert
コード:
<script type=”text/javascript”>
var number = 30;
alert(number);
</script>
<script type=”text/javascript”>
var number = 30;
alert(number);
</script>
console.log
コード:
<script type=”text/javascript”>
console.warn(“warn”);
console.error(“error”);
console.info(“info”);
console.log(“log”);
</script>
<script type=”text/javascript”>
console.warn(“warn”);
console.error(“error”);
console.info(“info”);
console.log(“log”);
</script>
<script type=”text/javascript”>
var number = [12,13,14];
console.table(number);
</script>
var number = [12,13,14];
console.table(number);
</script>
<script type=”text/javascript”>
var number = [12,13,14];
console.trace(number);
</script>
var number = [12,13,14];
console.trace(number);
</script>
document.write
コード:
<script type=”text/javascript”>
var number = 300;
document.write(number);
</script>
<script type=”text/javascript”>
var number = 300;
document.write(number);
</script>