In this challenge we will assess your coding skills. Create a little project implementing a solution for the problem shown below. After you're done, please push your code to a public GitHub repository.
You have arrived in a long forgotten island, called kwego. After 3 days on this island, you realized that their numeric system is the same as the roman system but with different names and came up with the following kwegonian to roman translation table:
kil I
jin V
pol X
kilow L
jij C
jinjin D
polsx M
Now you'll code a library to translate from kwego system to decimal system.
Your library should pass the following jest test suite:
const kwegoToDec = require('./your-lib');
test('kwego to decimal translation', () => {
expect(kwegoToDec('kil kil kil')).toBe(3);
expect(kwegoToDec('jin kil')).toBe(6);
expect(kwegoToDec('kil jin')).toBe(4);
expect(kwegoToDec('kilow pol')).toBe(60);
expect(kwegoToDec('pol jij')).toBe(90);
expect(kwegoToDec('polsx polsx pol jin kil')).toBe(2016);
expect(kwegoToDec('polsx polsx jinjin pol kilow kil jin')).toBe(2544);
});
Implementing the library using pure funcional paradigm would be a plus!
- You should come up with the translation algorithm for yourself (that's the point of the challenge)
- Feel free to look up online javascript documentation any time you need to!
Good luck!