DEV Community

Discussion on: Daily Challenge #47 - Alphabets

Collapse
 
alexkhismatulin profile image
Alex Khismatulin
function alphabetPosition(text) {
  return text.toUpperCase().replace(/[^A-Z]/g, '').replace(/[A-Z]/g, str => str.charCodeAt() - 64 + ' ').trim();
}