생활
자바스크립트 문자열함수 질문입니다
<html>
<head>
</head>
<body>
<script langauge="javascript">
names = "john,"+"and smith";
sayhello = "nice to meet you," + "" + names;
last_char=names.charAt(names.length-1); //--문자열 마지막에서 두번째 문자
sub=names.substring(1,4); //--문자열 첫번째에서 4번째까지 문자
index=names.indexof('o'); //--문자열에 o찾기
document.write(names);
document.write(sub);
document.write(index);
</script>
</body>
</html>
자바스크립트 문자열 함수로 이것저것 실험해보는 중입니다 나름 코드를 짜봤는데 아무것도 출력이 되지 않습니다 변수선언을 잘못한걸까요? 아니면 document.write으로는 출력할 수 없는건가요?
1개의 답변이 있어요!