-
-
Notifications
You must be signed in to change notification settings - Fork 337
Expand file tree
/
Copy path2-initials.js
More file actions
15 lines (11 loc) · 674 Bytes
/
2-initials.js
File metadata and controls
15 lines (11 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
let firstName = "Creola";
let middleName = "Katherine";
let lastName = "Johnson";
// Declare a variable called initials that stores the first character of each string.
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.
let initials = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}`;
console.log(initials);
console.log(typeof initials);
// https://www.google.com/search?q=get+first+character+of+string+mdn
// I used the mdn documentation to know how to get the first character of a string.
// I used charAt() method that takes the index of a string and return the character of it.