<!DOCTYPE html>
<html>
<body>
<script>
'use strict';
if (!String.prototype.repeat) {
String.prototype.repeat = function(n) {
return new Array(n + 1).join(this);
};
}
alert( "La".repeat(3) ); // LaLaLa
</script>
</body>
</html>
I didn't understand the following line of code:
if (!String.prototype.repeat)