-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-initials.js
More file actions
18 lines (11 loc) · 691 Bytes
/
Copy path2-initials.js
File metadata and controls
18 lines (11 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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.
// You can use the .charAt() method of strings to get a character at a specific position in a string.
// The first character is at position 0, the second at position 1, and so on.
let initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0);
// https://www.google.com/search?q=get+first+character+of+string+mdn
// Log the initials variable to the console
console.log(initials);