Return month long name based on number input
function monthName(num) {
return new Date(2000, num - 1).toLocaleString("en-us", {month: "long"});
}
Return first & last item in an array
function firstLast(arr) {
return [arr.shift(), arr.pop()]
}
When comparing strings and characters, includes() is case-sensitive.
Count matching char in a string (case-sensitive)
function charCount(myChar, str) {
return [...str].filter(x => x===myChar).length;
}
Top comments (0)