Editor Arrow Download Open
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>JavaScript new keyword to create user-define object</title> </head> <body> <pre> <!-- Use pre element for work document.writeln() method --> <script type="text/javascript"> function Employee(name, salary) { this.name = name this.salary= 15000; } var employee = new Employee("Opal Kole", "15000") document.writeln("Employee Name: " + employee.name); document.writeln("Employee Salary: " + employee.salary); </script> </pre> </body> </html>
  Preview Arrow