JavaScript 기능을 개체로 사용하려면 다음 코드를 실행해 보세요. -
예시
<html> <head> <title>User-defined objects</title> <script> function book(title, author){ this.title = title; this.author = author; } </script> </head> <body> <script> var myBook = new book("Amit", "Python"); document.write("Book title is : " + myBook.title + "<br>"); document.write("Book author is : " + myBook.author + "<br>"); </script> </body> </html>