Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function alphabetPosition(text) {
- let a = text
- let g = 0
- let b = []
- var c = ""
- let t = 1
- for (let i = 0; i < a.length; i++) {
- b[i] = a[i]
- }
- for (let i = 0; i < a.length; i++) {
- g = a[i].charCodeAt(0)
- if ((g >= 65 && g <= 90) || (g >= 97 && g <= 122) ) {
- if(t!=1) c += " "
- t++
- if (g >= 65 && g <= 90) {
- c += g - 64
- }
- if (g >= 97 && g <= 122) {
- c += g - 96
- }
- }
- }
- return c;
- }
- console.log(alphabetPosition("The sunset sets at twelve o' clock."))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement