Problem 15

Compare Strings Recursion Challenge

Given two strings, determine whether they are exactly identical by comparing them character by character.

Function Signature

compareStr(str1, str2)

Parameters

  • str1 — a string.
  • str2 — a string.

Output

Return true if the strings are identical, or false otherwise.

Constraints

  • The function must use recursion.
  • The function should accept exactly two arguments.

Examples

compareStr('tomato', 'tomato')   → true
compareStr('house', 'houses')    → false
compareStr('', '')               → true
compareStr('', 'pop')            → false
compareStr('big dog', 'big dog') → true