<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
//메소드
function set(title,author,price){
this.title = title;
this.author =author;
this.price =price;
}
</script>
</head>
<body>
<h2>book 객체 만들기</h2>
<hr>
<script>
var i;
var bookArray = new Array();
var newArray = new Array();
for(i=0;i<5;i++){
bookArray[i] = prompt("콤마(,)로 분리하면서 책제목 저자 가격 순으로 입력","");
}
for(i=0;i<5;i++){
sp =bookArray[i].split(",");
var book = new Object();
book.title = sp[0];
book.author = sp[1];
book.price = sp[2];
newArray[i] = book;
}
for(i=0;i<5;i++){
document.write(newArray[i].title + ", ");
document.write(newArray[i].author + ", ");
document.write(newArray[i].price + "<br>");
}
document.write("<hr>가장 가격이 비싼 책은 ");
</script>
</body>
</html>
프롬프트창에 입력받고 그냥 그 입력받은 값이 없어지고 결과가 안나와요