JavaScript怎样注释掉某行代码
时间:2022-02-11 17:25
JavaScript注释掉某行代码的方法:1、利用“//”可以注释掉单行的代码,语法为“//单行代码”;2、利用“ /*”作为开头,利用“*/”作为结尾可以注释多行代码,语法为“/* 多行代码 */”。 本教程操作环境:windows10系统、javascript1.8.5版、Dell G3电脑。 JavaScript怎样注释掉某行代码 javascript单行注释 单行注释以"//"开头,到改行的末尾结束。下面是javascript单行注释实例: javascript多行注释 多行注释以 /* 开始,以 */ 结尾。下面的例子使用多行注释来解释代码: 【相关推荐:javascript学习教程】 以上就是JavaScript怎样注释掉某行代码的详细内容,更多请关注gxlsystem.com其它相关文章!<html>
<head>
<title>javascript单行注释</title>
<script language="javascript">
<!--
// The first alert is below
alert("An alert triggered by JavaScript!");
// Here is the second alert
alert("A second message appears!");
// -->
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<title>javascript多行注释</title>
<script language="javascript">
<!--
/*
Below two alert() methods are used to
fire up two message boxes - note how the
second one fires after the OK button on the
first has been clicked
*/
alert("An alert triggered by JavaScript!");
alert("A second message appears!");
// -->
</script>
</head>
<body>
</body>
</html>