Circular shift Roman letters in CoffeeScript

in code


This Codewars problem annoyed the crap out of me.

shift = (letter, amount) ->
  mod = if /[A-Z]/.test letter then 65 else 97
  String.fromCharCode mod + (letter.charCodeAt(0) + amount) % mod % 26

The formula to constrain a number to a range is:

(range_start + offset_here) % range_start % range_size


Replace Odd Numbers of Spaces Only

in code

Remap a JavaScript Object

in code

Coffee is Good

in code


Your email address will not be published. Required fields are marked *