add a javascript excercise

This commit is contained in:
Andreas Zweili 2017-06-23 22:51:22 +02:00
parent a7e5a84f1a
commit 0b7a64ab39
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<script type="text/javascript" src="return_month.js"></script>
<title>JavaScript</title>
</head>
<body onload="returnMonth();">
<h1>JavaScript</h1>
</body>
</html>

View File

@ -0,0 +1,8 @@
function returnMonth() {
var monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November",
"December"]
var currentDate = new Date();
var m = monthNames[currentDate.getMonth()];
alert(m);
}