Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
One-liner with match() and length solution in Creative category for Follow Instructions by mounaiban
import assert from "assert";
// z : instructionzz
var follow = (z,f=(s,q)=>(s.match(RegExp(q,'g'))||'').length)=>[f(z,'r')-f(z,'l'),f(z,'f')-f(z,'b')];
console.log('Example:');
console.log(follow('fflff'));
// These "asserts" are used for self-checking
assert.deepEqual(follow('fflff'), [-1, 4]);
assert.deepEqual(follow('ffrff'), [1, 4]);
assert.deepEqual(follow('fblr'), [0, 0]);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
Aug. 18, 2020