forked from TrainingByPackt/Professional-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise57.js
More file actions
34 lines (25 loc) · 856 Bytes
/
Exercise57.js
File metadata and controls
34 lines (25 loc) · 856 Bytes
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
function generateRandomString(length) {
const characters = [];
const characterSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < length; i++) {
characters.push(characterSet.charAt(generateRandomNumber(0, characterSet.length)));
}
return characters.join('');
}
function generateRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
console.log(generateRandomString(16));
console.log(Math.PI);
function circleArea(radius) {
return Math.pow(radius, 2) * Math.PI;
}
const now = new Date();
console.log(now);
const past = new Date('August 31, 2007 00:00:00');
console.log(past);
console.log(past.getFullYear());
console.log(past.getMonth());
console.log(past.getDate());
console.log(past.toString());
console.log(Math.floor(Date.now() / 1000));