{"id":8967,"date":"2021-09-30T23:07:55","date_gmt":"2021-09-30T20:07:55","guid":{"rendered":"https:\/\/elzero.org\/?p=8967"},"modified":"2022-09-28T18:10:35","modified_gmt":"2022-09-28T15:10:35","slug":"tutorials-random-background-color","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/tutorials-random-background-color\/","title":{"rendered":"Random Background Color"},"content":{"rendered":"<h3>\u0627\u0644 Code<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-javascript\">\r\n\/* \r\n  Practice\r\n  - Random Background Color\r\n*\/\r\n\r\n\/\/ #fd34f7 FF00FF\r\n\r\nlet hexArray = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \"A\", \"B\", \"C\", \"D\", \"E\", \"F\"];\r\nlet colorParts = [];\r\n\r\nfor (let i = 0; i < 6; i++) {\r\n  colorParts.push(hexArray[Math.floor(Math.random() * hexArray.length)]);\r\n}\r\n\r\nlet finalColor = `#${colorParts.join(\"\")}`;\r\n\r\ndocument.body.append(finalColor);\r\ndocument.body.style.backgroundColor = finalColor;\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-8967","post","type-post","status-publish","format-standard","hentry","category-front-end-tutorials"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8967","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=8967"}],"version-history":[{"count":2,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8967\/revisions"}],"predecessor-version":[{"id":8969,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8967\/revisions\/8969"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}