Basics
Verlan is a type of argot in the french language and is common in slang and youth language.
It rests on a long french tradition of transposing syllables of individual words to create slang words.
The word itself is an example for verlan.
Task
In this example you will create a function that takes a word and makes a verlan word out of it.
e.g.
- Maestro => Stromae
- Verlan => Lanver
function maestroSplit(string) {
let newWord = string.slice(parseInt(string.length / 2)) + string.slice(0, parseInt(string.length / 2));
return newWord.toLowerCase().charAt(0).toUpperCase() + newWord.toLowerCase().slice(1);
}
// Since Node 10, we're using Mocha.
// You can use `chai` for assertions.
const chai = require("chai");
const assert = chai.assert;
// Uncomment the following line to disable truncating failure messages for deep equals, do:
// chai.config.truncateThreshold = 0;
// Since Node 12, we no longer include assertions from our deprecated custom test framework by default.
// Uncomment the following to use the old assertions:
const Test = require("@codewars/test-compat");
describe("maestroSplit", function() {
it("should transform verLan to Lanver", () => {
Test.assertEquals(maestroSplit("verLan"), "Lanver");
});
it("should transform français to Çaisfran", () => {
Test.assertEquals(maestroSplit("français"), "Çaisfran");
});
it("should transform Maestro to Stromae", () => {
// Test.assertEquals(1 + 1, 2);
// assert.strictEqual(1 + 1, 2);
Test.assertEquals(maestroSplit("Maestro"), "Stromae");
});
it("should transform MaEsTrO to Stromae", () => {
Test.assertEquals(maestroSplit("MaEsTrO"), "Stromae");
});
it("should transform warscode to Codewars", () => {
Test.assertEquals(maestroSplit("wArScODE"), "Codewars");
});
});