JavaScript 배열 indexOf()

Jmnote (토론 | 기여)님의 2023년 10월 28일 (토) 14:58 판 (새 문서: ==개요== ;JavaScript Array indexOf() ;자바스크립트 배열 indexOf() <syntaxhighlight lang='javascript' run> const arr = ["hello", "world", "hello"]; console.log(arr.indexOf("...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

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 }}