"JavaScript 문자열 startsWith()"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
3번째 줄: 3번째 줄:
;자바스크립트 startsWith()
;자바스크립트 startsWith()


<syntaxhighlight lang='JavaScript'>
<syntaxhighlight lang='JavaScript' run>
var str = "Hello world!";
var str = "Hello world!";
console.log( str.startsWith("Hello") ); // true
console.log( str.startsWith("Hello") ); // true
9번째 줄: 9번째 줄:
console.log( str.startsWith("ll") ); // false
console.log( str.startsWith("ll") ); // false
console.log( str.startsWith("ll", 2) ); // true
console.log( str.startsWith("ll", 2) ); // true
</syntaxhighlight>
<syntaxhighlight lang='javascript' run>
const str1 = 'Saturday night plans';
console.log(str1.startsWith('Sat')); // true
console.log(str1.startsWith('Sat', 3)); // false
</syntaxhighlight>
<syntaxhighlight lang='javascript' run>
const str = "To be, or not to be, that is the question.";
console.log(str.startsWith("To be")); // true
console.log(str.startsWith("not to be")); // false
console.log(str.startsWith("not to be", 10)); // true
</syntaxhighlight>
</syntaxhighlight>



2023년 3월 25일 (토) 10:15 판

1 개요

JavaScript startsWith()
자바스크립트 startsWith()
var str = "Hello world!";
console.log( str.startsWith("Hello") ); // true
console.log( str.startsWith("He") ); // true
console.log( str.startsWith("ll") ); // false
console.log( str.startsWith("ll", 2) ); // true
const str1 = 'Saturday night plans';
console.log(str1.startsWith('Sat')); // true
console.log(str1.startsWith('Sat', 3)); // false
const str = "To be, or not to be, that is the question.";
console.log(str.startsWith("To be")); // true
console.log(str.startsWith("not to be")); // false
console.log(str.startsWith("not to be", 10)); // true

2 같이 보기

3 참고

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