{"id":3659,"date":"2020-06-10T22:23:41","date_gmt":"2020-06-10T19:23:41","guid":{"rendered":"https:\/\/elzero.org\/?p=3659"},"modified":"2020-06-12T22:39:27","modified_gmt":"2020-06-12T19:39:27","slug":"constructor-function-intro","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/constructor-function-intro\/","title":{"rendered":"Constructor Function Intro"},"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*\/\r\n\r\nfunction Phone(serial, color, price) {\r\n  this.serial = serial;\r\n  this.color = color;\r\n  this.price = price - 100;\r\n}\r\n\r\nlet phone1 = new Phone(123, \"Red\", 500);\r\nlet phone2 = new Phone(159, \"Black\", 500);\r\nlet phone3 = new Phone(167, \"Silver\", 500);\r\n\r\nconsole.log(phone1.serial);\r\nconsole.log(phone1.color);\r\nconsole.log(phone1.price);\r\n\r\nconsole.log(phone2.serial);\r\nconsole.log(phone2.color);\r\nconsole.log(phone2.price);\r\n\r\nconsole.log(phone3.serial);\r\nconsole.log(phone3.color);\r\nconsole.log(phone3.price);\r\n\r\n\/\/ const phone1 = {\r\n\/\/   serial: 123,\r\n\/\/   color: \"Red\",\r\n\/\/   price: 500,\r\n\/\/ };\r\n\r\n\/\/ const phone2 = {\r\n\/\/   serial: 159,\r\n\/\/   color: \"Black\",\r\n\/\/   price: 500,\r\n\/\/ };\r\n\r\n\/\/ const phone3 = {\r\n\/\/   serial: 167,\r\n\/\/   color: \"Silver\",\r\n\/\/   price: 500,\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-3659","post","type-post","status-publish","format-standard","hentry","category-javascript-oop"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/3659","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=3659"}],"version-history":[{"count":2,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/3659\/revisions"}],"predecessor-version":[{"id":3765,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/3659\/revisions\/3765"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=3659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=3659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=3659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}