const str = 'typescript. javascript. node.js c++';
const lastIndex = str.lastIndexOf('.');
const before = str.slice(0, lastIndex);
console.log(before);
const after = str.slice(lastIndex + 1);
console.log(after);
/*
run:
"typescript. javascript. node"
"js c++"
*/