We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d31ac48 commit b7b178bCopy full SHA for b7b178b
src/01-2-basics.js
@@ -11,6 +11,24 @@
11
function generateBandName(clothingColor, lastFoodEaten) {
12
// Your code here
13
// Initialize bandName to an empty string
14
+ let bandName = "";
15
// Function to capitalize the first letter of each word
16
+
17
+ function capitalizeFirstLetter(word) {
18
+ if (typeof word === "number") {
19
+ return word.toString();
20
+ }
21
+ if (typeof word !== "string" || word === null) {
22
+ return "";
23
24
+ return word.charAt(0).toUpperCase() + word.slice(1).toLocaleLowerCase();
25
26
// Construct the band name
27
+ bandName =
28
+ "The " +
29
+ capitalizeFirstLetter(clothingColor) +
30
+ " " +
31
+ capitalizeFirstLetter(lastFoodEaten);
32
33
+ return bandName;
34
}
0 commit comments