{"id":8011,"date":"2021-07-09T01:42:54","date_gmt":"2021-07-08T22:42:54","guid":{"rendered":"https:\/\/elzero.org\/?p=8011"},"modified":"2022-09-28T18:04:23","modified_gmt":"2022-09-28T15:04:23","slug":"tutorials-random-element-from-sequence","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/tutorials-random-element-from-sequence\/","title":{"rendered":"Random Element From Sequence"},"content":{"rendered":"<h3>\u0627\u0644 Code<\/h3>\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\n\/\/ Ahmed => Index 0\r\n\/\/ Sayed => Index 1\r\n\/\/ Ali => Index 2\r\n\r\nlet arr = [\"Ahmed\", \"Sayed\", \"Ali\"];\r\n\r\nconsole.log(arr.length); \/\/ 3\r\n\r\nconsole.log(Math.random() * arr.length);\r\n\r\nconsole.log(Math.floor(Math.random() * arr.length));\r\nconsole.log(Math.trunc(Math.random() * arr.length));\r\n\r\nconsole.log(arr[Math.trunc(Math.random() * arr.length)]);\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>\u0627\u0644 Code<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[879],"tags":[],"class_list":["post-8011","post","type-post","status-publish","format-standard","hentry","category-front-end-tutorials"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8011","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=8011"}],"version-history":[{"count":1,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8011\/revisions"}],"predecessor-version":[{"id":8012,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8011\/revisions\/8012"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}