Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

anagram js

const isAnagram = (str1, str2) => {
	const str2Arr = str2.split('');
	for(let i = 0; i < str1.length; i++) {
		const index = str2Arr.indexOf(str1[i]);
		if(index === -1) return false;
   		str2Arr.splice(index, 1);
    }
	return !str2Arr.length;
}
 
PREVIOUS NEXT
Tagged: #anagram #js
ADD COMMENT
Topic
Name
4+7 =