Skip to main content
Commonmark migration
Source Link

##JavaScript (ES6), 100 95 bytes

JavaScript (ES6), 100 95 bytes

(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

This is a valid JavaScript Lambda function. Outputs as function return. Takes in three arguments (a,b,c). Add f= at the beginning and invoke like f(arg1,arg2,arg3).

f=(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

console.log(f(prompt("Value for A"),prompt("Value for B"),prompt("Value for C")))

##JavaScript (ES6), 100 95 bytes

(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

This is a valid JavaScript Lambda function. Outputs as function return. Takes in three arguments (a,b,c). Add f= at the beginning and invoke like f(arg1,arg2,arg3).

f=(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

console.log(f(prompt("Value for A"),prompt("Value for B"),prompt("Value for C")))

JavaScript (ES6), 100 95 bytes

(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

This is a valid JavaScript Lambda function. Outputs as function return. Takes in three arguments (a,b,c). Add f= at the beginning and invoke like f(arg1,arg2,arg3).

f=(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

console.log(f(prompt("Value for A"),prompt("Value for B"),prompt("Value for C")))

Corrected things and golfed some bytes.
Source Link
Arjun
  • 5.1k
  • 2
  • 24
  • 56

##JavaScript (ES6), 100100 95 bytes

(a,b,c)=>{return a.split=>1?("")t=[...a].map((e)=>{fore=>b[0]==e?(var i=0;i<bu=c[0],b=b.length;i++slice(1)if,c=c.slice(b[i]==e1)return c[i];return ,u):e})}.join``,b==""?t:a):a

Run it online! This is a valid JavaScript Lambda function. Outputs as function return. Takes in three arguments (a,b,c). Add f= at the beginning and invoke like f(arg1,arg2,arg3).

f=(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

console.log(f(prompt("Value for A"),prompt("Value for B"),prompt("Value for C")))

##JavaScript (ES6), 100 bytes

(a,b,c)=>{return a.split("").map((e)=>{for(var i=0;i<b.length;i++)if(b[i]==e)return c[i];return e})}

Run it online!

##JavaScript (ES6), 100 95 bytes

(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

This is a valid JavaScript Lambda function. Outputs as function return. Takes in three arguments (a,b,c). Add f= at the beginning and invoke like f(arg1,arg2,arg3).

f=(a,b,c)=>1?(t=[...a].map(e=>b[0]==e?(u=c[0],b=b.slice(1),c=c.slice(1),u):e).join``,b==""?t:a):a

console.log(f(prompt("Value for A"),prompt("Value for B"),prompt("Value for C")))

deleted 2 characters in body
Source Link
Arjun
  • 5.1k
  • 2
  • 24
  • 56

JavaScript (ES6), 100 bytes ##JavaScript (ES6), 100 bytes

(a,b,c)=>{return a.split("").map((e)=>{for(var i=0;i<b.length;i++)if(b[i]==e)return c[i];return e})}

Run it online!

JavaScript (ES6), 100 bytes

(a,b,c)=>{return a.split("").map((e)=>{for(var i=0;i<b.length;i++)if(b[i]==e)return c[i];return e})}

Run it online!

##JavaScript (ES6), 100 bytes

(a,b,c)=>{return a.split("").map((e)=>{for(var i=0;i<b.length;i++)if(b[i]==e)return c[i];return e})}

Run it online!

deleted 90 characters in body
Source Link
Arjun
  • 5.1k
  • 2
  • 24
  • 56
Loading
added 12 characters in body
Source Link
Arjun
  • 5.1k
  • 2
  • 24
  • 56
Loading
added 20 characters in body
Source Link
Arjun
  • 5.1k
  • 2
  • 24
  • 56
Loading
added 25 characters in body
Source Link
Arjun
  • 5.1k
  • 2
  • 24
  • 56
Loading
Source Link
Arjun
  • 5.1k
  • 2
  • 24
  • 56
Loading