"함수 str repeat()"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
[[category: string]]
[[category: string]]
;str_repeat
;str_repeat
;*


==JavaScript==
<source lang='JavaScript'>
String.prototype.repeat = function(n){return new Array(n+1).join(this); }
console.log( "hello".repeat( 3 ) );
</source>
==PHP==
==PHP==
[[category: PHP]]
[[category: PHP]]

2015년 2월 14일 (토) 23:01 판

str_repeat

1 JavaScript

String.prototype.repeat = function(n){return new Array(n+1).join(this); }
console.log( "hello".repeat( 3 ) );

2 PHP

echo str_repeat("hello", 3);
// hellohellohello

3 Python

print "hello" * 3
# hellohellohello

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}