function returnName(Aname) {
return // first name and only first charctars of seconed name
}
console.log(returnName(`Ali Ahmad`)); // Ali A
CodePudding user response:
You can use:
function returnName(name) {
const [f,s] = name.split(' ')
return `${f} ${s.charAt(0)}`
}
console.log(returnName(`Ali Ahmad`));