## how do i get this javascript function to output "" for the last function example instead of nothing? Examples repeat( "cow", 3 ) => "cowcowcow" repeat( "alf", 10 ) =>...


##


how do i get this javascript function to output "" for the last function example instead of nothing?


Examples




  • repeat( "cow", 3 ) => "cowcowcow"

  • repeat( "alf", 10 ) => "alfalfalfalfalfalfalfalfalfalf"

  • repeat( "repeat", -3 ) => ""



function repeat(text,n) {
    result="";
    for(var i=0; i
        result+=text;
    }
    return result;
}



Answer below?




Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here