티스토리 뷰
문자열 속성 : length : 문자열 길이 구하기 : 반환(숫자)
.length는 문자열이나 숫자열 길이를 반환하는 속성입니다.
{
const str1 = "자바스크립트";
const currentStr1 = str1.length;
const str2 = "javascript";
const currentStr2 = str2.length;
}
번호 | 기본값 | 메서드 | 결괏값 |
1 | 자바스크립트 | length | 6 |
2 | javascript | length | 10 |
{
const arrNum = [100, 200, 300, 400, 500];
const arrNumLength = arrNum.length;
const arrText = ['a', 'b', 'c', 'd', 'e'];
const arrTextLength = arrText.length;
const arr = [1, 2, ['a', 'b']];
const arrLength = arr.length;
}
번호 | 기본값 | 메서드 | 결괏값 |
1 | [100, 200, 300, 400, 500] | .length | 5 |
2 | ['a', 'b', 'c', 'd', 'e'] | .length | 5 |
3 | [1, 2, ['a', 'b']]; | .length | 3 |
반응형
'Javascript' 카테고리의 다른 글
자바스크립트 - Arguments(아규먼트) (0) | 2022.04.15 |
---|---|
자바스크립트 정규식표현 (1) | 2022.04.15 |
자바스크립트 전역변수와 지역변수 (0) | 2022.04.14 |
자바스크립트 출력 (1) | 2022.04.14 |
데이터 불러오기04 (1) | 2022.03.07 |
댓글
© 2022 babydevelop