Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
5 Rollback to Revision 3
source | link

JavaScript, 43 47 4647 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%(+'$&$''+$`$`+ +'$&$'')"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

-1 byte: Remove one extra space thanks @Neil.

JavaScript, 43 47 46 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%(+'$&$''+$`)"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

-1 byte: Remove one extra space thanks @Neil.

JavaScript, 43 47 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%($`+ +'$&$'')"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

4 added 62 characters in body
source | link

JavaScript, 43 4747 46 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%($`+ +'$&$''+'$&$''+$`)"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

-1 byte: Remove one extra space thanks @Neil.

JavaScript, 43 47 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%($`+ +'$&$'')"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

JavaScript, 43 47 46 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%(+'$&$''+$`)"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

-1 byte: Remove one extra space thanks @Neil.

3 added 104 characters in body
source | link

JavaScript, 4343 47 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%($`+$&$'$`+ +'$&$'')"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

JavaScript, 43 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%($`+$&$')"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.

JavaScript, 43 47 bytes

f=
n=>eval(n.replace(/./g,'+'+n+"%($`+ +'$&$'')"))

I.oninput=_=>O.value=f(I.value)
<input id=I>
<input id=O disabled>

Takes input as string.


Edit:

+4 bytes: Leading zeroes in JavaScript converts the number to octal ):

2 deleted 12 characters in body
source | link
1
source | link