javascript输出语句有哪几种
javascript输出语句有哪几种
javascript中的输出语句有:1.alert语句,显示消息给用户;2.console.log语句,在浏览器控制台中打印输出信息;3.document.write语句,在网页中输出内容;
javascript中的输出语句有以下几种
1.alert语句
javascript中alert语句的作用是用于显示消息给用户,经常使用于创建一个消息正告框。
alert语句使用方法:
<script type="text/javascript">
alert("hello world!");
</script>
2.console.log语句
javascript中console.log语句的作用是在浏览器控制台中打印输出信息。
console.log语句使用方法:
<script type="text/javascript">
console.log("hello world!");
</script>
3.document.write语句
javascript中document.write语句的作用是在网页中输出内容,经常使用于向网页输出一段文字。
document.write语句使用方法:
<script type="text/javascript">
document.write("hello world!");
</script>
文章来源:丸子建站
文章标题:javascript输出语句有哪几种
https://www.wanzijz.com/view/3256.html