Answers for "7.2. Bracket Notation¶"

0

7.2. Bracket Notation¶

/*An expression of the form someString[i] gives the character at index i.
This program prints out the initials of the person's name.*/

let jsCreator = "Brendan Eich";
let firstInitial = jsCreator[0];
let lastInitial = jsCreator[8];

let outputStr = "JavaScript was created by somebody with initials " +
   firstInitial + "." +
   lastInitial + ".";

console.log(outputStr);
Posted by: Guest on June-13-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language