Changed the identations

This commit is contained in:
AnishTiwari 2019-02-17 14:38:09 +05:30 committed by GitHub
parent 672e2864a8
commit 5279eb2098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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');
}