"JavaScript 배열 indexOf()"의 두 판 사이의 차이

태그: 되돌려진 기여
태그: 수동 되돌리기
 
(같은 사용자의 중간 판 하나는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;JavaScript String indexOf()
;JavaScript Array indexOf()
;자바스크립트 문자열열 indexOf()
;자바스크립트 배열 indexOf()


<syntaxhighlight lang='javascript' run>
<syntaxhighlight lang='javascript' run>
const str = "hello world hello";
const arr = ["hello", "world", "hello"];
console.log(str.indexOf("hello")); // 1
console.log(arr.indexOf("hello")); // 0
console.log(str.indexOf("yellow")); // -1 (not exists)
console.log(arr.indexOf("yellow")); // -1 (not exists)
console.log(str.indexOf("hello", 4)); // 12
console.log(arr.indexOf("hello", 2)); // 2
</syntaxhighlight>
</syntaxhighlight>


==같이 보기==
==같이 보기==
* [[자바스크립트 indexOf()]]
* [[자바스크립트 indexOf()]]
* [[자바스크립트 배열 indexOf()]]
* [[자바스크립트 문자열 indexOf()]]


[[분류: JavaScript 문열]]
[[분류: JavaScript 배열]]

2023년 10월 28일 (토) 15:02 기준 최신판

1 개요[ | ]

JavaScript Array indexOf()
자바스크립트 배열 indexOf()
const arr = ["hello", "world", "hello"];
console.log(arr.indexOf("hello")); // 0
console.log(arr.indexOf("yellow")); // -1 (not exists)
console.log(arr.indexOf("hello", 2)); // 2

2 같이 보기[ | ]

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