Browse Source

Add function to get the decimal value of a char

ApisNecros 2 years ago
parent
commit
f27a18c0b4
1 changed files with 13 additions and 0 deletions
  1. 13 0
      starfish.js

+ 13 - 0
starfish.js

@@ -294,4 +294,17 @@ class Stack {
     PushLength() {
     PushLength() {
         this.stack.push(this.stack.length);
         this.stack.push(this.stack.length);
     }
     }
+}
+
+/**
+ * Get the char code of any character
+ *
+ * Can actually take any length of a value, but only returns the
+ * char code of the first character.
+ *
+ * @param {*} value Any character
+ * @returns {int} The value's char code
+ */
+function dec(value) {
+    return value.toString().charCodeAt(0);
 }
 }