📜  7.2.括号表示法¶ - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:32.045000             🧑  作者: Mango

代码示例1
/*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);