The repeat() is called on a string which takes one argument (number of times the string needs to be repeated) and returns a new string , containing the repetitions of the string on which it was called (argument times), concatenated together.
Note - The argument passed must be non-negative and the new string formed must not overflow the maximum string size.
'#'.repeat(3) returns '###'
Top comments (0)