Skip to main content
Commonmark migration
Source Link

#JavaScript, 59 58 bytes

JavaScript, 59 58 bytes

Input & output as an array of strings.

a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))

##Try it

Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))
)(s.split`,`).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>


##Original

Original

Takes input as an array of strings and outputs an array of character arrays

a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))

o.innerText=(g=s=>(f=
a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))
)(s.split`,`).map(x=>x.join``).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

#JavaScript, 59 58 bytes

Input & output as an array of strings.

a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))

##Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))
)(s.split`,`).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>


##Original

Takes input as an array of strings and outputs an array of character arrays

a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))

o.innerText=(g=s=>(f=
a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))
)(s.split`,`).map(x=>x.join``).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

JavaScript, 59 58 bytes

Input & output as an array of strings.

a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))

Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))
)(s.split`,`).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>


Original

Takes input as an array of strings and outputs an array of character arrays

a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))

o.innerText=(g=s=>(f=
a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))
)(s.split`,`).map(x=>x.join``).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

deleted 47 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#JavaScript, 59 58 bytes

Input & output as an array of strings.

a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))

##Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))
)(s.split`,`).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>


##Original

Takes input as an array of strings and outputs an array of character arrays

a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))

o.innerText=(g=s=>(f=
a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))
)(s.split`,`).map(x=>x.join``).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

#JavaScript, 59 58 bytes

Input & output as an array of strings.

a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))

##Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))
)(s.split`,`).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

#JavaScript, 59 58 bytes

Input & output as an array of strings.

a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))

##Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))
)(s.split`,`).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>


##Original

Takes input as an array of strings and outputs an array of character arrays

a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))

o.innerText=(g=s=>(f=
a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))
)(s.split`,`).map(x=>x.join``).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

deleted 47 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94

#JavaScript, 5959 58 bytes

Takes inputInput & output as an array of strings, outputs as an array of character arrays.

a=>a.map(x=>[...`x=>`-0123456789`]0123456789`.mapreplace(y=>-~x.searcheval(y`/[^${x}]/g`)?y:,` `))

##Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>[...`x=>`-0123456789`]0123456789`.mapreplace(y=>-~x.searcheval(y`/[^${x}]/g`)?y:,` `))
)(s.split`,`).map(x=>x.join``).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

#JavaScript, 59 bytes

Takes input as an array of strings, outputs as an array of character arrays.

a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))

##Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>[...`-0123456789`].map(y=>-~x.search(y)?y:` `))
)(s.split`,`).map(x=>x.join``).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

#JavaScript, 59 58 bytes

Input & output as an array of strings.

a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))

##Try it

o.innerText=(g=s=>(f=
a=>a.map(x=>`-0123456789`.replace(eval(`/[^${x}]/g`),` `))
)(s.split`,`).join`\n`)(i.value="1,729,4728510,-3832,748129321,89842,-938744,0,11111");oninput=_=>o.innerText=g(i.value)
input{width:100%;}
<input id=i><pre id=o></pre>

added 533 characters in body
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading
Source Link
Shaggy
  • 43.5k
  • 4
  • 36
  • 94
Loading