javascript输出语句有哪些

lewis 2019-03-26 24次阅读

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>




发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。