Repeat a string: Difference between revisions
→{{header|JavaScript}}
Line 723:
console.log("ha".repeat(5)); // hahahahaha</lang>
For larger numbers of repetitions, however, it proves significantly faster to progressively double a copy of the original string (concatenating it with itself), and appending
See the technique of 'Egyptian Multiplication' described in the Rhind Mathematical Papyrus at the British Museum.
|