Skip to content

Commit dc17501

Browse files
committed
Implemented the function to get the initials as output without writing out the initials
1 parent 704f58f commit dc17501

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
// Declare a variable called initials that stores the first character of each string.
2+
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
3+
14
let firstName = "Creola";
25
let middleName = "Katherine";
36
let lastName = "Johnson";
47

5-
// Declare a variable called initials that stores the first character of each string.
6-
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
78

8-
let initials = ``;
9+
function getInitials() {
10+
return `${firstName[0]}${middleName[0]}${lastName[0]}`;
11+
}
12+
13+
console.log(getInitials());
14+
15+
// Export the initials for testing instead of returning at top-level
16+
module.exports = getInitials;
17+
918

10-
// https://www.google.com/search?q=get+first+character+of+string+mdn
1119

0 commit comments

Comments
 (0)