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

check for string anagram javascript

function compare (a, b) {
    var y = a.split("").sort().join(""),
        z = b.split("").sort().join("");
    console.log(z === y
        ? a + " and " + b + " are anagrams!"
        : a + " and " + b + " are not anagrams."
    );
}
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 :: javascript margin top 
Javascript :: reduce average javascript 
Javascript :: convert da decimale a hex javascript 
Javascript :: get data and time in javascript 
Javascript :: wrap text react native 
Javascript :: NullInjectorError: No provider for HttpClient! 
Javascript :: js loop ul 
Javascript :: remove all numbers from string javascript 
Javascript :: js object length 
Javascript :: window.href 
Javascript :: how to replace all characters in a string javascript 
Javascript :: how to get the value of radio button in jquery 
Javascript :: email regex specific domain simple 
Javascript :: react scroll to bottom of div 
Javascript :: javascript detect mobile device 
Javascript :: listen prop change vuejs 
Javascript :: vimeo id regex 
Javascript :: after load page jquery 
Javascript :: Get random name from an array in javascript 
Javascript :: loop 
Javascript :: disable auto suggest html 
Javascript :: check one checkbox at a time jquery 
Javascript :: for elem in list javascript 
Javascript :: three.js create sphere 
Javascript :: using material ui icons in react 
Javascript :: image touchable opacity react native 
Javascript :: boton de copiar en html y js 
Javascript :: node js favicon.ico 
Javascript :: split the numbers js 
Javascript :: concurrently node react 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =