js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Solve 'Fake Binary' #323

Closed odv closed 5 years ago

odv commented 5 years ago

https://www.codewars.com/kata/fake-binary/train/javascript

RazvanBugoi commented 5 years ago
function fakeBin(x){
let output = "";
  for (let i=0; i<x.length; i+=1) {
    if (x[i] < 5) {
      output += 0;
      } else { output += 1; }
    }
    return output;
}