"자바스크립트 indexOf()"의 두 판 사이의 차이

4번째 줄: 4번째 줄:


<syntaxhighlight lang='javascript' run>
<syntaxhighlight lang='javascript' run>
console.log("hello world hello".indexOf("hello") ); // 1
console.log("hello world hello".indexOf("hello")); // 1
console.log("hello world hello".indexOf("hello",4)); //
console.log("hello world hello".indexOf("yellow")); // -1 (not exists)
console.log("hello world hello".indexOf("yellow",4)); // -1
console.log("hello world hello".indexOf("hello", 4)); // 12
</syntaxhighlight>
</syntaxhighlight>



2023년 10월 28일 (토) 14:53 판

1 개요

JavaScript indexOf()
자바스크립트 indexOf()
console.log("hello world hello".indexOf("hello")); // 1
console.log("hello world hello".indexOf("yellow")); // -1 (not exists)
console.log("hello world hello".indexOf("hello", 4)); // 12

2 같이 보기

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