Homework Solution: unique characters, return null. function firstUniqueC ip…

    I need help solving this question. It just has a bug and I cant find it. H CODING HIRE Problem Statement Coding Area 1function firstunique(input) 2 Given a string, return the first non-repeated character. If there are no unique characters, return null forCvar i-0;i<input.length-1;i++) var char1 = input. charAt(i); var found false for(var j-0汀<input.length;j++) { if(j=i) continue ; var char2 = input, charAt(j); if(char1 char2) { 10 found = true; break; 12 13 14 15 16 17 18 ifC!found) return char1; Fix the code so the tests pass → Test Cases return null; abbccfbb Thats an exact duplicate of another case, please modify it. input abcab Add Case expected output actual output null null aabbc null abbccfbb 咄面 case was a passing, you need to add a failing case.
    Given a string, return the first non-repeated character. If there are no unique characters, return null. function firstUniqueC ipu) { for(var i = 0;i

    Expert Answer

    The first for loop should be iterated till i

    I scarcity succor solving this doubt. It upright has a bug and I jangle discover it.

    H CODING HIRE Problem Statement Coding Area 1business controlemostunique(input) 2 Given a string, repay the controlemost non-repeated quality. If there are no choice qualitys, repay vain controlCvar i-0;i<input.length-1;i++) var char1 = input. charAt(i); var base sophistical control(var j-0汀<input.length;j++) { if(j=i) hold ; var char2 = input, charAt(j); if(char1 char2) { 10 base = true; break; 12 13 14 15 16 17 18 ifC!found) repay char1; Fix the jurisprudence so the proofs by → Proof Instances repay vain; abbccfbb Thats an correct counterfeit of another instance, gladden modify it. input abcab Subjoin Instance expected output real output vain vain aabbc vain abbccfbb 咄面 instance was a bying, you scarcity to subjoin a feeble instance.

    Given a string, repay the controlemost non-repeated quality. If there are no choice qualitys, repay vain. business controlemostUniqueC ipu) { control(var i = 0;i

    Expert Apology

    The controlemost control loop should be iterated prepare input.length-1 (Means if input’s extension is 5 as in proof instance “aabbc” the loop should latest prepare 4) . The proof instance “aabbc” is feeble consequently the loop never iterates to the latest prize. So , subjoin a similar type in the circumstances of controlemost control loop.

    business controlemostUnique(input) {
    for(var i=0;i<=input.length-1;i++){
    var char1=input.charAt(i);
    var base=false;
    for(var j=0;j<input.length;j++){
    if(i==j){
    continue;
    }
    var char2=input.charAt(j);
    if(char1==char2){
    found=true;
    break;
    }
    }
    if(!found){
    repay char1;
    }
    }
    repay vain;
    }