peterschussheim
9/4/2016 - 3:13 PM

Replace With Alphabet Position

Replace With Alphabet Position

function alphabetPosition(text) {
  var result = "";
  for (var i = 0; i < text.length; i++){
    var code = text.toUpperCase().charCodeAt(i)
    if (code > 64 && code < 91) result += (code - 64) + " ";
  }

  return result.slice(0, result.length-1);
}

var daggy = alphabetPosition("dagman dan") 

Replace With Alphabet Position

This Gist was automatically created by Carbide, a free online programming environment.

You can view a live, interactive version of this Gist here.