repeat string using repeat built in function code example Example: repeat string using repeat built in function var str = "Hello world!"; str.repeat(2);