const s: string = "typescript";
// Example 1
let index: number = Math.floor(s.length / 2) ;
console.log(s[index]);
// Example 2
const len = s.length;
index = Math.floor(len / 2) ;
if (len % 2 == 1) {
console.log(s[index]);
} else if (len % 2 == 0) {
console.log(s[index - 1], s[index]);
}
/*
run:
"c"
"s", "c"
*/