Write a JavaScript function to repeat a string a specified times.