-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass_ex2.html
More file actions
27 lines (24 loc) · 767 Bytes
/
class_ex2.html
File metadata and controls
27 lines (24 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Class Example</title>
</head>
<body>
<h3>Example of Class in Java Script</h3>
<p id="demo"></p>
<script>
class Employee{
constructor(emp_id,emp_name,emp_designation){
this.emp_id = emp_id;
this.emp_name = emp_name;
this.emp_designation = emp_designation
}
}
emp1 = new Employee(101,"Good coder","SDE");
document.getElementById('demo').innerHTML = emp1.emp_id+" "+emp1.emp_name+" "+emp1.emp_designation;
</script>
</body>
</html>