{"id":546,"date":"2024-06-05T14:44:09","date_gmt":"2024-06-05T14:44:09","guid":{"rendered":"https:\/\/beinthecloud.biz\/sfdc\/1\/?p=546"},"modified":"2024-06-05T14:44:09","modified_gmt":"2024-06-05T14:44:09","slug":"the-for-loop-in-javascript","status":"publish","type":"post","link":"https:\/\/beinthecloud.biz\/sfdc\/1\/2024\/06\/05\/the-for-loop-in-javascript\/","title":{"rendered":"The for loop in JavaScript"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>for (initialization; condition; increment) {\r\n    \/\/ Code to be executed\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>Here&#8217;s an example of a simple <code>for<\/code> loop that prints the numbers from 1 to 10:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for (let i = 1; i &lt;= 10; i++) {\r\n    console.log(i);\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>Example that loops through an array and prints each element:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>let fruits = &#91;\"apple\", \"banana\", \"cherry\"];\r\n\r\nfor (let i = 0; i &lt; fruits.length; i++) {\r\n    console.log(fruits&#91;i]);\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s an example of a simple for loop that prints the numbers from 1 to 10: Example that loops through an array and prints each element:<\/p>\n","protected":false},"author":1,"featured_media":544,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[16],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-content\/uploads\/2024\/06\/JavaScript-Logo-scaled.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/posts\/546"}],"collection":[{"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/comments?post=546"}],"version-history":[{"count":1,"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/posts\/546\/revisions"}],"predecessor-version":[{"id":547,"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/posts\/546\/revisions\/547"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/media\/544"}],"wp:attachment":[{"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/media?parent=546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/categories?post=546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/beinthecloud.biz\/sfdc\/1\/wp-json\/wp\/v2\/tags?post=546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}