console.log(repeat_string('a', 10));
console.log(repeat_string('a',-1));
console.log(repeat_string('a'));

function repeat_string(char,num)
{
    var temp = []
    if(num<0 || num == null)
    {
        return 'Invalid';
    }
    else
    {
        for(var i =0 ; i<num ; i++)
        {
            temp.push(char);
        }
        return temp.join('');
    }
    
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: