본문 바로가기
개발자공간/SCRIPT

jquery - split 문자열 자르기 예제

by 냉국이 2021. 6. 8.
728x90
var test = "2021/06/08";
test = test.split("/"); // 문자열 '/'기준으로 자른다.


console.log(test[0]); // 결과 : 2021
console.log(test[1]); // 결과 : 06
console.log(test[2]); // 결과 : 08



var test = "제,이,쿼,리";
test = test.split(","); // 문자열 ','기준으로 자릅니다.

console.log(test[0]); // 결과 : 제
console.log(test[1]); // 결과 : 이
console.log(test[2]); // 결과 : 쿼
console.log(test[3]); // 결과 : 리
300x250

댓글