Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. // var person = {
  12. // firstName: "John",
  13. // lastName: "Snow",
  14. // getfullName: function(){
  15. // console.log(this.firstName + " " + this.lastName);
  16. // }
  17. // }
  18.  
  19. var person = {
  20. firstName: "John",
  21. lastName: "Snow",
  22. getfullName: function(){
  23. //var self = this;
  24. //var fn = function(){
  25.  
  26. var fn = () => {
  27. console.log(this.firstName + " " + this.lastName);
  28. }
  29.  
  30.  
  31. return fn();
  32.  
  33. //}.bind(this);
  34.  
  35.  
  36. }
  37. }
  38.  
  39. person.getfullName();
  40. </script>
  41.  
  42.  
  43.  
  44. <script id="jsbin-source-javascript" type="text/javascript">// var person = {
  45. // firstName: "John",
  46. // lastName: "Snow",
  47. // getfullName: function(){
  48. // console.log(this.firstName + " " + this.lastName);
  49. // }
  50. // }
  51.  
  52. var person = {
  53. firstName: "John",
  54. lastName: "Snow",
  55. getfullName: function(){
  56. //var self = this;
  57. //var fn = function(){
  58.  
  59. var fn = () => {
  60. console.log(this.firstName + " " + this.lastName);
  61. }
  62.  
  63.  
  64. return fn();
  65.  
  66. //}.bind(this);
  67.  
  68.  
  69. }
  70. }
  71.  
  72. person.getfullName();</script></body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement