Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript anagram check

const areAnagram = (str1, str2) => str1.toLowerCase().split('').sort().join('') === str2.toLowerCase().split('').sort().join('');

// Examples
areAnagram('listen', 'silent');         // true
areAnagram('they see', 'the eyes');     // true
areAnagram('node', 'deno');             // true
Comment

anagram checker javascript

function anagrams(stringA, stringB) {
    return cleanString(stringA) === cleanString(stringB);
}

function cleanString(str) {
    return str.replace(/[^w]/g).toLowerCase().split('').sort().join()
}   

anagrams('monk','konm')
Comment

PREVIOUS NEXT
Code Example
Javascript :: how click button and redirect angular 
Javascript :: insert element at beginning of array javascript 
Javascript :: fetch request 
Javascript :: sum of odd numbers in an array javascript without loop 
Javascript :: NextJS + Material-UI - Warning: Prop className did not match 
Javascript :: loops in javascript 
Javascript :: node convert string to hash 
Javascript :: jwt expiresin 
Javascript :: node js vs jquery 
Javascript :: Hide angular element on button click 
Javascript :: jquery validation on click 
Javascript :: jquery checkbox group selected value 
Javascript :: javascript new line 
Javascript :: nuxt plugin 
Javascript :: javascript convert number to spreadsheet column 
Javascript :: execcommand javascript 
Javascript :: yup phone number validation 
Javascript :: ws.browser regeneratorRuntime is not defined angular 
Javascript :: how to serve css files express 
Javascript :: css vw not working on mobile 
Javascript :: async arrow function js 
Javascript :: nodejs save blob file 
Javascript :: jquery check is select 
Javascript :: average of numbers 
Javascript :: chart js two layer label 
Javascript :: create empty json file python 
Javascript :: jquery json to table 
Javascript :: javaScript setHours() Method 
Javascript :: javascript primitive data types 
Javascript :: at leastone checkbox required jquery 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =