- in-line comment
- multi-line comment
- inline javascript in html
- external javascript file in html
// this is an in-line comment
/* this is a
multi-line comment */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
console.log('JavaScript');
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="http://code.jquery.com/jquery.js"></script>
</body>
</html>
- The semicolon can be omitted but it has to be at the end of the javascript code
console.log('JavaScript');
console
.
log
(
'Hello World'
);
// Hello World
break, continue, throw, ++, --
console.log('smart'); consol.log('Hello World');