how to make fake binary

JavaScript
function fakeBin(x) {
  return x.replace(/\d/g, d => d < 5 ? 0 : 1);
}
// for code wars lol
Source

Also in JavaScript: