study
javascript 문자열 길이 length
intseq
2019. 7. 13. 19:09
string.length
ex)'abc'.length
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>JavaScript</title>
<style>
body {
font-family: Consolas, monospace;
}
</style>
</head>
<body>
<script>
document.write( '<p>"1234".length : ' + '1234'.length + '</p>' );
document.write( '<p>"".length : ' + ''.length + '</p>' );
document.write( '<p>"한글".length : ' + '한글'.length + '</p>' );
</script>
</body>
</html>