{"id":10867,"date":"2022-06-08T20:50:22","date_gmt":"2022-06-08T17:50:22","guid":{"rendered":"https:\/\/elzero.org\/?p=10867"},"modified":"2022-08-07T07:56:47","modified_gmt":"2022-08-07T04:56:47","slug":"javascript-implement-string-length-function","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/javascript-implement-string-length-function\/","title":{"rendered":"String Length Function"},"content":{"rendered":"<h3>\u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062f\u0631\u0633<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\nconsole.log(\"Elzero\".length); \/\/ 6\r\n\r\n\/\/ function elzeroStringLength(str) {\r\n\/\/   let index = 0;\r\n\/\/   while (str) {\r\n\/\/     if (str[index] === undefined) {\r\n\/\/       break;\r\n\/\/     }\r\n\/\/     index++;\r\n\/\/   }\r\n\/\/   return index;\r\n\/\/ }\r\n\r\nfunction elzeroStringLength(str) {\r\n  let index = 0;\r\n  while (str[index] !== undefined) {\r\n    index++;\r\n  }\r\n  return index;\r\n}\r\n\r\nconsole.log(elzeroStringLength(\"\")); \/\/ 0\r\nconsole.log(elzeroStringLength(\"Elzero\")); \/\/ 6\r\nconsole.log(elzeroStringLength(\"Elzero Web\")); \/\/ 10\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>\u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062f\u0631\u0633<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1156],"tags":[],"class_list":["post-10867","post","type-post","status-publish","format-standard","hentry","category-functions-implement"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/10867","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=10867"}],"version-history":[{"count":2,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/10867\/revisions"}],"predecessor-version":[{"id":11702,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/10867\/revisions\/11702"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=10867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=10867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=10867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}