Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
sort then join solution in Clear category for [old] Verify Anagrams by Sim0000
"use strict";
function verifyAnagrams(first_word, second_word){
const f = x => x.toLowerCase().replace(/\s/g, '').split('').sort().join();
return f(first_word) == f(second_word);
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(verifyAnagrams("Programming", "Gram Ring Mop"), true, "Gram of code");
assert.equal(verifyAnagrams("Hello", "Ole Oh"), false, "Hello! Ole Oh!");
assert.equal(verifyAnagrams("Kyoto", "Tokyo"), true, "The global warming crisis of 3002");
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
March 17, 2017
Comments: