温馨提示×

javascript输出语句有哪些

养鱼的猫咪
420
2021-04-12 11:52:47
栏目: 编程语言
前端开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

javascript中的输出语句有:1.alert语句,显示消息给用户;2.console.log语句,在浏览器控制台中打印输出信息;3.document.write语句,在网页中输出内容;

javascript输出语句有哪些

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>

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:常用的java输出语句有哪些

0