From 5279eb2098de74580ea251d5b2810adfdcafcf71 Mon Sep 17 00:00:00 2001 From: AnishTiwari Date: Sun, 17 Feb 2019 14:38:09 +0530 Subject: [PATCH] Changed the identations --- src/algorithms/string/anagram.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/algorithms/string/anagram.js b/src/algorithms/string/anagram.js index b96c9765..ba415bb8 100644 --- a/src/algorithms/string/anagram.js +++ b/src/algorithms/string/anagram.js @@ -1,21 +1,21 @@ // TO CHECK IF TWO STRINGS ARE ANAGRAM OR NOT -function anagram(word1, word2){ - var sorted1 = word1.split("").sort().join(""); //SORTING WORD1 - var sorted2 = word2.split("").sort().join(""); //SORTING WORD2 +function anagram(word1, word2) { + let sorted1 = word1.split('').sort().join(''); //SORTING WORD1 + let sorted2 = word2.split('').sort().join(''); //SORTING WORD2 - //COMPARING LENGTH AND CHECKING === - if (sorted1.length == sorted2.length && sorted1 === sorted2) { - return true; - } - else{ - return false; - } + //COMPARING LENGTH AND CHECKING === + if (sorted1.length === sorted2.length && sorted1 === sorted2) { + return true; + } + else{ + return false; + } } -if(anagram("binary", "brainy")){ - alert("AN ANAGRAM"); +if(anagram('binary', 'brainy')){ + alert('AN ANAGRAM'); } else{ - alert("NOT AN ANAGRAM"); + alert('NOT AN ANAGRAM'); }