Created
January 4, 2016 23:52
-
-
Save mmloveaa/7815f4f931da1d74cad0 to your computer and use it in GitHub Desktop.
get ascii value of character
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1/4/2016 | |
// get ascii value of character | |
// write a function getASCII which inputs a character and returns the corresponding | |
// ascii value for that character. Example : getASCII('A') => 65 | |
// for ASCII table, you can refer to http://www.asciitable.com/ | |
// Test.assertEquals(getASCII('A'),65) | |
// Test.assertEquals(getASCII(' '),32) | |
// Test.assertEquals(getASCII('!'),33) | |
function getASCII(c){ | |
return c.charCodeAt(0); | |
} | |
getASCII('!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment