This commit is contained in:
David Ralph
2019-03-22 20:05:51 +00:00
parent 6ed2abc3b4
commit 8d8831f64b
3 changed files with 7 additions and 7 deletions

View File

@@ -123,4 +123,4 @@ module.exports = class Message {
else if (hour > 18) time = 'Dod eftermiddag'; // If it's before 6pm, set the time string to "Good afternoon"
setHTMLContent('.greeting', time); // Write the string contents to the HTML
}
}
};

View File

@@ -20,22 +20,22 @@ module.exports = class Util {
// format time
static formatTimeUnit(unit) {
return unit < 10 ? '0' + unit : unit;
};
}
// setHTMLContent is the kind of function that is referred to as a 'wrapper'
static setHTMLContent(selector, content) {
return document.querySelector(selector).innerHTML = content;
};
}
// get random item
static getRandIndex(array) {
return Math.floor(Math.random() * (array.length - 1));
};
}
// pick random from array
static pickFromArray(array) {
return array[Math.floor(Math.random() * (array.length - 1))];
};
}
static contains(needle) {
let findNaN = needle !== needle;