{"id":4341,"date":"2020-06-26T02:21:12","date_gmt":"2020-06-25T23:21:12","guid":{"rendered":"https:\/\/elzero.org\/?p=4341"},"modified":"2020-06-26T02:21:12","modified_gmt":"2020-06-25T23:21:12","slug":"constructor-function-dealing-with-properties","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/constructor-function-dealing-with-properties\/","title":{"rendered":"Constructor Function Dealing With Properties"},"content":{"rendered":"<h3>\u0627\u0644 Code \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a \u0627\u0644\u062f\u0631\u0633<\/h3>\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\n\/*\r\n  Constructor Function\r\n  Dealing With Properties\r\n  40% to 60%\r\n*\/\r\n\r\nfunction User(fName, lName, age, country) {\r\n  this.fName = fName;\r\n  this.lName = lName;\r\n  this.age = age;\r\n  this.country = country;\r\n  this.fullName = function () {\r\n    return `Full Name: ${this.fName} ${this.lName}`;\r\n  };\r\n  this.ageInDays = function () {\r\n    return `Age In Days: ${this.age * 365}`;\r\n  };\r\n}\r\n\/\/ User.country = \"Egypt\"; Wrong\r\n\r\nlet user1 = new User(\"Osama\", \"Elzero\", 37, \"Egypt\");\r\nlet user2 = new User(\"Ahmed\", \"Ali\", 30, \"KSA\");\r\n\r\nconsole.log(user1);\r\nconsole.log(`Full Name: ${user1.fName} ${user1.lName}`);\r\nconsole.log(user1.fullName());\r\nconsole.log(user1.ageInDays());\r\nconsole.log(user2);\r\nconsole.log(user2.country);\r\nconsole.log(user2.ageInDays());\r\n\r\n<\/script>\r\n<hr>\r\n<h3>\u0645\u0644\u0627\u062d\u0638\u0627\u062a \u0627\u0644\u062f\u0631\u0633<\/h3>\r\n\u0644\u0627 \u062a\u0648\u062c\u062f \u0645\u0644\u0627\u062d\u0638\u0627\u062a \u062d\u0627\u0644\u064a\u0627","protected":false},"excerpt":{"rendered":"<p>\u0627\u0644 Code \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a \u0627\u0644\u062f\u0631\u0633 \u0645\u0644\u0627\u062d\u0638\u0627\u062a \u0627\u0644\u062f\u0631\u0633 \u0644\u0627 \u062a\u0648\u062c\u062f \u0645\u0644\u0627\u062d\u0638\u0627\u062a \u062d\u0627\u0644\u064a\u0627<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[436],"tags":[],"class_list":["post-4341","post","type-post","status-publish","format-standard","hentry","category-javascript-oop"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/4341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=4341"}],"version-history":[{"count":2,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/4341\/revisions"}],"predecessor-version":[{"id":4343,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/4341\/revisions\/4343"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=4341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=4341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=4341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}