如何在JavaScript中创建自定义对象?
要在JavaScript中创建自定义对象,请尝试以下代码
示例
<!DOCTYPE html> <html> <body> <p id="test"></p> <script> var dept = new Object(); dept.employee = "Amit"; dept.department = "Technical"; dept.technology ="Java"; document.getElementById("test").innerHTML = dept.employee + " is working on " + dept.technology + " technology."; </script> </body> </html>