Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isleOfMan(arr = []) {
- const pattern = /^([#$%*&])([A-Za-z]+)\1=(\d+)!!(.+)/;
- for (let i = 0; i < arr.length; i++) {
- const matches = pattern.exec(arr[i]);
- if (matches) {
- const [, , racer, length, geohash] = matches;
- if (Number(length) !== geohash.length) {
- console.log('Nothing found!');
- continue;
- }
- const decryptedGeohash = geohash
- .split('')
- .map(char => {
- const charCode = char.charCodeAt(0);
- return String.fromCharCode(charCode + Number(length));
- })
- .join('');
- console.log(`Coordinates found! ${racer} -> ${decryptedGeohash}`);
- return;
- } else {
- console.log('Nothing found!');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement