fork(1) download
  1. function temp(str) {
  2.  
  3. const vowelMap = {
  4. a: "ant",
  5. e: "ex",
  6. i: "ishq",
  7. o: "off",
  8. u: "ufo"
  9. };
  10.  
  11. return str.split('').forEach(function(c) {
  12. console.log(vowelMap[c.toLowerCase()]);
  13.  
  14. c = (vowelMap['c'] === undefined) ? c : c + vowelMap['c'];
  15. console.log(c);
  16. });
  17. }
  18.  
  19.  
  20. const ans = temp("I love water");
  21. console.log(ans);
Success #stdin #stdout 0.03s 17560KB
stdin
Standard input is empty
stdout
ishq
I
undefined
 
undefined
l
off
o
undefined
v
ex
e
undefined
 
undefined
w
ant
a
undefined
t
ex
e
undefined
r
undefined