저장을 습관화

자바스크립트 문자열 특정 자리의 글자 구하기 .charAt() 본문

공부/JavaScript

자바스크립트 문자열 특정 자리의 글자 구하기 .charAt()

ctrs 2023. 9. 7. 17:48

문자열 변수 str이 있을때

let str = "abcdefg";

console.log(str[0]); // a

console.log(str.charAt(2)); // c

배열처럼 str[]로 찾고 싶은 자리의 위치를 정하던가

.charAt() 메소드를 사용하던가

 

참조

https://ctrs.tistory.com/191

 

프로그래머스 LV.0 대소문자 바꿔서 출력하기

프로그래머스 LV.0 대소문자 바꿔서 출력하기 https://school.programmers.co.kr/learn/courses/30/lessons/181949 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형

ctrs.tistory.com