{"id":34386,"date":"2024-11-01T09:27:33","date_gmt":"2024-11-01T09:27:33","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=34386"},"modified":"2024-11-01T11:41:28","modified_gmt":"2024-11-01T11:41:28","slug":"javascript-coding-test-course-finding-the-good-number","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/34386\/","title":{"rendered":"Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;"},"content":{"rendered":"<p><body><\/p>\n<h2>Introduction<\/h2>\n<p>\n        Having a basic understanding of programming languages is essential for solving algorithm problems, which are a crucial element of coding tests. In particular, JavaScript is a language that is essential for web development and frontend fields, and many companies are presenting problems using JavaScript. In this course, we will learn the applicability of JavaScript through the problem of &#8216;Good Numbers&#8217; and explain the algorithm problem-solving process in detail.\n    <\/p>\n<h2>Problem Description<\/h2>\n<p>\n        The &#8216;Good Numbers&#8217; problem is about finding numbers that satisfy certain conditions among the given numbers. The specifics of this problem are as follows:\n    <\/p>\n<p><strong>Problem:<\/strong> Given an array of positive integers, write a function that removes duplicates from the array and prints all numbers less than 10. Additionally, calculate the average of the remaining numbers up to one decimal place and return it.<\/p>\n<h2>Input and Output Format<\/h2>\n<p>\n        Input: An array of positive integers arr ([1, 2, 2, 3, 10, 5, 7, 15])<br \/>\n        Output: <br \/>\n        1. List of numbers less than 10 after removing duplicates<br \/>\n        2. Average of the remaining numbers (up to one decimal place)\n    <\/p>\n<h2>Example<\/h2>\n<pre>\n    Input: [1, 2, 2, 3, 10, 5, 7, 15]\n    Output: \n    Numbers after removing duplicates (less than 10): [1, 2, 3, 5, 7]\n    Average: 3.6\n    <\/pre>\n<h2>Problem-Solving Approach<\/h2>\n<p>\n        To solve the problem, we need to follow the steps of removing duplicates from the array and calculating the average of the filtered array. We will look at how to perform these tasks step by step using JavaScript.\n    <\/p>\n<h3>Step 1: Remove Duplicates<\/h3>\n<p>\n        We can use the Set object to remove duplicate elements from the array. The Set object does not allow duplicates automatically, so we can easily obtain the desired result using this object.\n    <\/p>\n<pre><code>\nconst arr = [1, 2, 2, 3, 10, 5, 7, 15];\nconst uniqueArr = [...new Set(arr)];\nconsole.log(uniqueArr); \/\/ [1, 2, 3, 10, 5, 7, 15]\n    <\/code><\/pre>\n<h3>Step 2: Filtering<\/h3>\n<p>\n        Now, we will perform the task of filtering numbers less than 10 from the array with duplicates removed. We can use JavaScript&#8217;s filter() method to extract only the elements that meet the condition.\n    <\/p>\n<pre><code>\nconst filteredArr = uniqueArr.filter(num =&gt; num &lt; 10);\nconsole.log(filteredArr); \/\/ [1, 2, 3, 5, 7]\n    <\/code><\/pre>\n<h3>Step 3: Calculate Average<\/h3>\n<p>\n        To calculate the average of the filtered array, we can use the reduce() method. We can get the average by summing all the elements of the array and dividing the total by the number of elements.\n    <\/p>\n<pre><code>\nconst average = filteredArr.reduce((acc, num) =&gt; acc + num, 0) \/ filteredArr.length;\nconsole.log(average.toFixed(1)); \/\/ 3.6\n    <\/code><\/pre>\n<h2>Complete Code<\/h2>\n<p>\n        Now, we will integrate all the described processes into a single function to write the final code.\n    <\/p>\n<pre><code>\nfunction goodNumbers(arr) {\n    const uniqueArr = [...new Set(arr)];\n    const filteredArr = uniqueArr.filter(num =&gt; num &lt; 10);\n    const average = filteredArr.reduce((acc, num) =&gt; acc + num, 0) \/ filteredArr.length;\n    return {\n        filteredNumbers: filteredArr,\n        average: average.toFixed(1)\n    };\n}\n\nconst inputArr = [1, 2, 2, 3, 10, 5, 7, 15];\nconst result = goodNumbers(inputArr);\nconsole.log(result);\n    <\/code><\/pre>\n<h2>Result<\/h2>\n<p>\n        When the code above is executed, the following result can be obtained.\n    <\/p>\n<pre><code>\n{\n    filteredNumbers: [1, 2, 3, 5, 7],\n    average: \"3.6\"\n}\n    <\/code><\/pre>\n<h2>Optimization and Considerations<\/h2>\n<p>\n        The above problem-solving method works well in practical applications. However, when dealing with large datasets, additional considerations regarding performance may be necessary. For example, while using a Set is a convenient way to extract unique values, it may lead to increased memory usage if the size of the array is very large. In such cases, several methods can be considered to improve the algorithm&#8217;s performance:\n    <\/p>\n<ul>\n<li>Explore methods to remove duplicates and filter at the same time.<\/li>\n<li>Improve performance based on the choice of data structure.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>\n        In this course, we explored the process of solving the &#8216;Good Numbers&#8217; problem using JavaScript. By removing duplicates, filtering numbers according to conditions, and calculating averages, we were able to enhance our basic algorithm problem-solving skills. It is important to practice solving such problems frequently while preparing for coding tests. I hope you gain a deeper understanding by utilizing the various features of JavaScript.\n    <\/p>\n<h2>Did You Find This Helpful?<\/h2>\n<p>\n        If this course has helped you prepare for JavaScript coding tests, try challenging other algorithm problems as well. Feel free to leave any difficulties or questions in the comments. I hope you have the opportunity to share your learning journey and grow together.\n    <\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Having a basic understanding of programming languages is essential for solving algorithm problems, which are a crucial element of coding tests. In particular, JavaScript is a language that is essential for web development and frontend fields, and many companies are presenting problems using JavaScript. In this course, we will learn the applicability of JavaScript &hellip; <a href=\"https:\/\/atmokpo.com\/w\/34386\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[141],"tags":[],"class_list":["post-34386","post","type-post","status-publish","format-standard","hentry","category-javascript-coding-test"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Javascript Coding Test Course, &#039;Finding the Good Number&#039; - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/34386\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Javascript Coding Test Course, &#039;Finding the Good Number&#039; - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Introduction Having a basic understanding of programming languages is essential for solving algorithm problems, which are a crucial element of coding tests. In particular, JavaScript is a language that is essential for web development and frontend fields, and many companies are presenting problems using JavaScript. In this course, we will learn the applicability of JavaScript &hellip; \ub354 \ubcf4\uae30 &quot;Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/34386\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:27:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:41:28+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/34386\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/34386\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;\",\"datePublished\":\"2024-11-01T09:27:33+00:00\",\"dateModified\":\"2024-11-01T11:41:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/34386\/\"},\"wordCount\":555,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Javascript Coding Test\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/34386\/\",\"url\":\"https:\/\/atmokpo.com\/w\/34386\/\",\"name\":\"Javascript Coding Test Course, 'Finding the Good Number' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:27:33+00:00\",\"dateModified\":\"2024-11-01T11:41:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/34386\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/34386\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/34386\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Javascript Coding Test Course, 'Finding the Good Number' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/34386\/","og_locale":"ko_KR","og_type":"article","og_title":"Javascript Coding Test Course, 'Finding the Good Number' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Introduction Having a basic understanding of programming languages is essential for solving algorithm problems, which are a crucial element of coding tests. In particular, JavaScript is a language that is essential for web development and frontend fields, and many companies are presenting problems using JavaScript. In this course, we will learn the applicability of JavaScript &hellip; \ub354 \ubcf4\uae30 \"Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;\"","og_url":"https:\/\/atmokpo.com\/w\/34386\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:27:33+00:00","article_modified_time":"2024-11-01T11:41:28+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/34386\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/34386\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;","datePublished":"2024-11-01T09:27:33+00:00","dateModified":"2024-11-01T11:41:28+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/34386\/"},"wordCount":555,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Javascript Coding Test"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/34386\/","url":"https:\/\/atmokpo.com\/w\/34386\/","name":"Javascript Coding Test Course, 'Finding the Good Number' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:27:33+00:00","dateModified":"2024-11-01T11:41:28+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/34386\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/34386\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/34386\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Javascript Coding Test Course, &#8216;Finding the Good Number&#8217;"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/34386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=34386"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/34386\/revisions"}],"predecessor-version":[{"id":34387,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/34386\/revisions\/34387"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=34386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=34386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=34386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}