function abbrev(str) { let finalStr = ''; const words = str.split('-'); for (let i = 0; i < words.length; i++) finalStr += `${words[i][0]}${words[i].length - 2}${words[i].slice(-1)}-`; return finalStr.slice(0, -1); }
- function abbrev(str) {
// TODO- let finalStr = '';
- const words = str.split('-');
- for (let i = 0; i < words.length; i++)
- finalStr += `${words[i][0]}${words[i].length - 2}${words[i].slice(-1)}-`;
- return finalStr.slice(0, -1);
- }