{"id":4352,"date":"2020-06-26T02:36:17","date_gmt":"2020-06-25T23:36:17","guid":{"rendered":"https:\/\/elzero.org\/?p=4352"},"modified":"2020-06-26T02:36:17","modified_gmt":"2020-06-25T23:36:17","slug":"js-oop-prototype-part-3-extend-constructors-features","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/js-oop-prototype-part-3-extend-constructors-features\/","title":{"rendered":"Prototype Part 3 Extend Constructors Features"},"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  Prototype\r\n*\/\r\n\r\nlet myString = \"Osama\";\r\n\r\nconsole.log(String.prototype);\r\n\r\nString.prototype.zFill = function (width) {\r\n  let theResult = this;\r\n\r\n  while (theResult.length < width) {\r\n    theResult = `0${theResult}`;\r\n  }\r\n\r\n  return theResult.toString();\r\n};\r\n\r\nconsole.log(\"12\".zFill(6));\r\nconsole.log(\"516\".zFill(6));\r\nconsole.log(\"3625\".zFill(6));\r\nconsole.log(\"25145\".zFill(6));\r\nconsole.log(\"987654\".zFill(6));\r\n\r\nString.prototype.sayYouLoveMe = function () {\r\n  return `I Love You ${this}`;\r\n};\r\n\r\nconsole.log(\"Osama\".sayYouLoveMe());\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-4352","post","type-post","status-publish","format-standard","hentry","category-javascript-oop"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/4352","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=4352"}],"version-history":[{"count":1,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/4352\/revisions"}],"predecessor-version":[{"id":4353,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/4352\/revisions\/4353"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=4352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=4352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=4352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}