We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9eef64e commit a397ec8Copy full SHA for a397ec8
JavaScript Function or Getter.html
@@ -0,0 +1,27 @@
1
+<!DOCTYPE html>
2
+<html>
3
+
4
+<body>
5
6
+ <h2>JavaScript Object Method</h2>
7
8
+ <p>Object data can be accessed using property stored as a function.</p>
9
10
+ <p id="demo"></p>
11
12
+ <script>
13
+ // Create an object:
14
+ var person = {
15
+ firstName: "Sanu",
16
+ lastName: "santh",
17
+ fullName: function () {
18
+ return this.firstName + " " + this.lastName;
19
+ }
20
+ };
21
+ // Display data from the object using a method:
22
+ document.getElementById("demo").innerHTML = person.fullName();
23
+ </script>
24
25
+</body>
26
27
+</html>
0 commit comments