...
function fun(e) {
var leet = {
a: '@',
b: '8',
c: '(',
d: '|)',
e: '3',
f: '|=',
g: '6',
h: '#',
i: '!',
j: ']',
k: '|{',
l: '1',
m: 'em',
n: '[\]',
o: '0',
p: '|*',
q: '0,',
r: '|2',
s: '$',
t: '7',
u: '(_)',
v: '\/',
w: 'vv',
x: '%',
y: '`/',
z: '2',
}
let message = e;
let leetmsg = ''
message = message.toLowerCase();
for(var a of message) {
if (leet[a]) {
leetmsg += leet[a];
} else {
leetmsg += char;
}
}
return leetmsg
}
// TODO: Add your tests here
// Starting from Node 10.x, [Mocha](https://mochajs.org) is used instead of our custom test framework.
// [Codewars' assertion methods](https://github.com/Codewars/codewars.com/wiki/Codewars-JavaScript-Test-Framework)
// are still available for now.
//
// For new tests, using [Chai](https://chaijs.com/) is recommended.
// You can use it by requiring:
// const assert = require("chai").assert;
// If the failure output for deep equality is truncated, `chai.config.truncateThreshold` can be adjusted.
var leet = {
a: '@'
, b: '8'
, c: '('
, d: '|)'
, e: '3'
, f: '|='
, g: '6'
, h: '#'
, i: '!'
, j: ']'
, k: '|{'
, l: '1'
, m: 'em'
, n: '[\]'
, o: '0'
, p: '|*'
, q: '0,'
, r: '|2'
, s: '$'
, t: '7'
, u: '(_)'
, v: '\/'
, w: 'vv'
, x: '%'
, y: '`/'
, z: '2'
}
let message = "string";
let leetmsg = ''
message = message.toLowerCase();
for(var a of message) {
if (leet[a]) {
leetmsg += leet[a];
} else {
leetmsg += char;
}
}
describe("Solution", function() {
it("should test for something", function() {
Test.assertEquals(fun(message), leetmsg);
Test.assertEquals(fun(message), leetmsg);
});
});