Comparing two strings

I am struggling with a codewars challenge:
Complete the function scramble(str1, str2) that returns true if a portion of str1 characters can be rearranged to match str2 , otherwise returns false .

it fails the tests console.log(scramble(‘scriptjavx’,‘javascript’)) and console.log(scramble(‘javscripts’,‘javascript’)).
I cannot figure out why. All help is appreciated

function scramble(str1, str2) {
 let arr1 = str1.split("")
 let arr2 = str2.split("")
 for (let i = 0; i < arr1.length; i++){
   for (let j = 0; j < arr2.length; j++){
      if (arr1[i] === arr2[j]){
       arr2.splice(j, 1)
      if (arr2.length === 0){
        return true
      }
  }}}
    return false
}

Hi,
you can just move the return true statement out of the loop.
At the bottom of the function body you can check whether length is 0 or not and return true or false accordingly.

I left it there to stop the loop if the condition was met early; eg if str1 was 100 characters long and str2 was 5 characters

But you just stop the loop then. The code after the loop is still executed. And it always returns false.
Break the loop if the array is empty, but do the check at the bottom of the function scope anyway.