Skip to content

Instantly share code, notes, and snippets.

@edtoken
Created July 6, 2017 16:00
Show Gist options
  • Save edtoken/e748e92d51624217cc9ae6391d058433 to your computer and use it in GitHub Desktop.
Save edtoken/e748e92d51624217cc9ae6391d058433 to your computer and use it in GitHub Desktop.
//https://www.codewars.com/kata/grill-it/train/javascript
function grille(message, code) {
let code_bin = (code >>> 0).toString(2);
let message_test = message.substr(-code_bin.length);
return Array.prototype.filter.call(message_test, (w, n) => (code_bin[n] == "1")).join('')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment