{"id":1184,"date":"2026-01-21T21:11:11","date_gmt":"2026-01-21T21:11:11","guid":{"rendered":"https:\/\/oliversimkovsky.com\/?p=1184"},"modified":"2026-01-22T11:08:05","modified_gmt":"2026-01-22T11:08:05","slug":"recent-javascript-projects","status":"publish","type":"post","link":"https:\/\/oliversimkovsky.com\/index.php\/2026\/01\/21\/recent-javascript-projects\/","title":{"rendered":"Recent JavaScript Projects"},"content":{"rendered":"\n<p>During this past week in my studies, I took on a couple of different small scale front-end projects utilizing JavaScript and Bootstrap. With these projects I took advantage of core JavaScript concepts such as functions, loops, arrays, conditionals and ternary expressions. I&#8217;ll share a few things I&#8217;ve worked on and go into how I solved each one. This is mainly to document my progress but of course in hopes that it&#8217;ll support others in their endeavors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Excuse Generator<\/h2>\n\n\n\n<p>This one is a simple excuse generator built with four arrays and five functions. The four arrays contain different parts of a sentence. For example, the first array named <code>who<\/code> contains a list of pronouns, the second array named <code>action<\/code> contains a list of verbs, so on and so forth. The first four functions look like this:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-67580743426d61578bb8882c99a9f357\"><code>function getRandomIndex(array) {\n    const length = array.length;\n    const result = Math.floor(Math.random() * length);\n\n    return result;\n\n  }<\/code><\/pre>\n\n\n\n<p>Just simply returning a variable that is equal to a random number between 0 and the length of the given array. I&#8217;m repeating this function for  every array.  Then with my last function, I&#8217;m putting all those randomized numbers into a final string of text, and this function returns that string of text. This is what it looks like: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function Result(array1, array2, array3, array4){\n    array1 = who&#91;getRandomIndex(who)];\n    array2 = action&#91;getSecondRandomIndex(action)];\n    array3 = what&#91;getThirdRandomIndex(what)];\n    array4 = when&#91;getFourthRandomIndex(when)];\n\n    let space = \" \";\n    return array1 + space + array2 + space + array3 + space + array4;\n  }<\/code><\/pre>\n\n\n\n<p>I&#8217;m passing each array into this function and storing the randomized index of each array into variables. I&#8217;m getting the randomized index using the functions I previously wrote and calling them here. At the end of this function I&#8217;m returning all the variables concatenated with a <code>space<\/code> variable between each one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>let finalResult = Result(who, action, what, when);\nconsole.log(finalResult);\ndocumentID.textContent = finalResult;<\/code><\/pre>\n\n\n\n<p>These last three lines logs the concatenated string returned by <code>Result<\/code> to the console and writes it to the document. Now whenever you reload the page a new excuse is generated based on given arrays. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Domain Name Generator<\/h2>\n\n\n\n<p>This project functions similarly to the excuse generator utilizing arrays and string concatenation, however  with the excuse generator I was using <code>Math.floor()<\/code> and <code>Math.random()<\/code> to come up with random sentences. For this one, I used a nested for loop that loops through the different array indexes to create domain names. Here&#8217;s how it looks:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const pronouns = &#91;'the', 'our'];\nconst adjectives = &#91;'sneaky', 'suspicious'];\nconst nouns = &#91;'person', 'friend'];\nconst suffixes = &#91;'com', 'net'];\n\nfor (let index in pronouns) {\n    for (let secondIndex in adjectives) {\n      for (let thirdIndex in nouns) {\n        for (let fourthIndex in suffixes) {\n          let myUL = document.getElementById(\"myUl\");\n          let myLi = document.createElement(\"li\");\n\n          myLi.textContent = pronouns&#91;index] + adjectives&#91;secondIndex] + nouns&#91;thirdIndex] + \".\" + suffixes&#91;fourthIndex];\n          myUL.appendChild(myLi);\n        }\n      }\n    }\n  }\n<\/code><\/pre>\n\n\n\n<p>As you can see, there are four arrays, and a loop with four levels of nesting. During the most outer loop&#8217;s first iteration, it will concatenate the first element with every possible combination before moving on to the next iteration. For example, first we will get &#8220;thesneakyperson.com&#8221; and then we will get &#8220;thesneakyperson.net&#8221;. After that we will get &#8220;thesneakyfriend.com&#8221; and then &#8220;thesneakyfriend.net&#8221; so on and so forth. Of course this all gets written to the document with every iteration, so we will see every possible domain name on the screen when the page loads. The whole purpose of this project was to get a handle on working with loops.<\/p>\n\n\n\n<p>That&#8217;s all I have this week! A short post but wanted to share how I&#8217;m applying what I&#8217;m learning from practices and readings. Through projects like these I&#8217;m really able to get a grasp on how to write useful algorithms. What I plan on writing about next is DOM manipulation, as that&#8217;s the next learning curve after JavaScript fundamentals. This is how JavaScript reads, changes, and reacts to elements on a web page after it&#8217;s loaded. Thanks for the read! As said earlier, hoping this post will help out others in their studies. Cheers!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During this past week in my studies, I took on a couple of different small scale front-end projects utilizing JavaScript and Bootstrap. With these projects I took advantage of core JavaScript concepts such as functions, &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_vp_format_video_url":"","_vp_image_focal_point":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1184","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/posts\/1184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/comments?post=1184"}],"version-history":[{"count":11,"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/posts\/1184\/revisions"}],"predecessor-version":[{"id":1196,"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/posts\/1184\/revisions\/1196"}],"wp:attachment":[{"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/media?parent=1184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/categories?post=1184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oliversimkovsky.com\/index.php\/wp-json\/wp\/v2\/tags?post=1184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}