Includes(2)
-
[Javascript] String 문자 검사 (startsWith, includes, endsWith)
startsWith, includes, endsWith는 String 문자 검사를 할 때 대표적으로 사용되는 세 가지이다. startsWith - 가장 첫 번째로 시작하는 문자를 검사 includes - 해당 문자열을 포함하는지 검사 endsWith - 마지막으로 끝나는 문자 검사 예시 소스 'use strict' let string = 'node.js 올인원 패키지'; // 가장 첫 시작 문자 검사 let isStartWith = string.startsWith('n'); // 해당 문자열을 포함하는지 let isIncludes = string.includes('올인원'); // 마지막 끝나는 문자 검사 let isEndWith = string.endsWith('지'); const checkIfCont..
2020.09.21 -
[Javascript] find, includes
find는 이전 포스트에서 findIndex 등과 다룬적이 있습니다. 본 포스트와 같이 보시면 좋을 것 같습니다. developing-move.tistory.com/11 Javascript 배열 내장 함수 정리(indexOf, findIndex, find) indexOf는 내가 원하는 텍스트 위치를 알려준다. const animals = ['호랑이', '사자', '사슴', '토끼', '거북이']; const index = animals.indexOf('사자'); console.log('사자의 위치는 : ' + index); 하지만 i.. developing-move.tistory.com Find는 설정된 배열의 특정한 요소를 찾는다. Find는 조건을 통해 특정 값을 가져올 필요가 있을 때 주로 사용한다..
2020.09.21