Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fix chr link

...

Code Block
languagejavascript
a = "K".ord(); // a: 75
b = "Kite".ord(); // b: 75
c = "Kite".split(re##).map(function(x){x.ord()}); // c: [75,105,116,101]
d = "K".ord().chr() == "K" // d: true

The inverse of ord() is chr().

replace()

The replace() operator takes two arguments: a regular expression and a string. The returned string is the original string with any match of the regular expression replaced by the second argument. You can use any captured values in the second, substitute string by naming them with $1, $2, and so on. The first captured value will be substituted for $1, the second for $2, and so on. For example:

...