JavaScript 문자열 lastIndexOf()

(JavaScript .lastIndexOf()에서 넘어옴)

1 개요[ | ]

JavaScript .lastIndexOf()
자바스크립트 문자열 lastIndexOf()
var url = "http://example.com/wiki/http-server";
var n = url.lastIndexOf("http");
console.log( n ); // 24
var str = "친구야, 안녕! 너는 나의 가장 좋은 친구야.";
var n = str.lastIndexOf("친구");
console.log( n ); // 21
const paragraph = 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?';
const searchTerm = 'dog';
console.log(`The index of the first "${searchTerm}" from the end is ${paragraph.lastIndexOf(searchTerm)}`); // Expected output: "The index of the first "dog" from the end is 52"

2 같이 보기[ | ]

3 참고[ | ]

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