-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjects_date_js.html
More file actions
37 lines (34 loc) · 1.11 KB
/
Copy pathobjects_date_js.html
File metadata and controls
37 lines (34 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Date and Time as Objects</title>
</head>
<body>
<script>
'use strict';
// todo:
// Create an array of months for printing dates
let months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', ' November', 'December'];
var monthToFind = 'August';
var indexOfMonths = months.indexOf(monthToFind) + 1;
var monthIndexLoop;
for (let i = 0; i < months.length; i++) {
if(months[i] === monthToFind) {
monthIndexLoop = i;
break;
}
}
// todo:
// Create the date corresponding to your birthday using the JavaScript Date object.
//let jsBirthday
let myBirthday = new Date(`${indexOfMonths} 14, 1969`);
// todo:
// Log your birthday in the format: January 1, 2014 using the JavaScript Date object.
// console.log(myBirthday);
// See link below for methods needed:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Getter
console.log(`Here is my birthday using JavaScript: ${myBirthday} `);
</script>
</body>
</html>