applying a certain consistency / non redifinition of variables when adding greetings

This commit is contained in:
Jean-Michel Bouchard 2020-12-31 14:57:01 -05:00
parent e2cf133e3f
commit 570ed0364c
2 changed files with 24 additions and 15 deletions

View File

@ -1,17 +1,22 @@
// Get the hour
var today = new Date();
var hour = today.getHours();
if (today === undefined) {
const today = new Date();
}
if (today === undefined) {
const hour = today.getHours();
}
// Here you can change your name
var name = 'John Doe';
const name = 'John Doe';
// Here you can change your greetings
var gree1 = 'Go to Sleep! ';
var gree2 = 'Good morning! ';
var gree3 = 'Good afternoon ';
var gree4 = 'Good evening ';
var gree5 = 'Good evening ';
var gree6 = 'Good evening ';
const gree1 = 'Go to Sleep! ';
const gree2 = 'Good morning! ';
const gree3 = 'Good afternoon ';
const gree4 = 'Good evening ';
const gree5 = 'Good evening ';
const gree6 = 'Good evening ';
// Define the hours of the greetings
if (hour >= 23 && hour < 5) {

View File

@ -32,14 +32,18 @@ themeToggle.addEventListener('click', () => {
});
// Change the theme with the time
// const today = new Date();
// const Hr = today.getHours();
/*
if (Hr >= 19 || Hr < 5) {
if (today === undefined) {
const today = new Date();
}
if (today === undefined) {
const hour = today.getHours();
}
if (hour >= 19 || hour < 5) {
enableDark();
} else {
disableDark();
}
*/
*/