Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Practice Challenge 3

Challenge-1

Write a function that accepts two strings and checks whether the first string is an anagram of the second string. If yes, the function returns true , else it returns false. The case(upper/lower)of the character MATTERS.

For eg.

function isAnagarm(str1,str2){
// write your code here
}
console.log(isAnagarm("Silent","liSten"));//=>true

console.log(isAnagarm("Silent","Listen"));//=>false

console.log(isAnagarm("Stressed", "desSerts"));// =>true

console.log(isAnagarm("StresSed","desSertS"));//=>true

console.log(isAnagar("StresSeD","DeSsertS"));//=>true

console.log(isAnagarm("StresSed","DesSertS"));//=>false

Challenge-2

Write a function that accepts two strings and checks whether the first string is an anagram of the second string. If yes, the function returns true , else it returns false. The case(upper/lower)of the character does not matter.

For eg.

function isAnagarm(str1,str2){
// write your code here
}
console.log(isAnagarm("Silent","liSten"));//=>true

console.log(isAnagarm("Brag","Grab"));//=>true

console.log(isAnagarm("Stressed", "Desserts"));// =>true

console.log(isAnagarm("Camel","Car"));//=>false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment