{"id":8102,"date":"2022-09-11T23:34:59","date_gmt":"2022-09-11T18:04:59","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/"},"modified":"2022-09-11T23:34:59","modified_gmt":"2022-09-11T18:04:59","slug":"solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/","title":{"rendered":"[Solved] I want to print only the repeated values once from an associative array"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-55771944\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"55771944\" data-parentid=\"55771879\" data-score=\"1\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Use <code>filter<\/code> and <code>map<\/code>, with a <code>Set<\/code> to remove the repeated values:<\/p>\n<\/p>\n<div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\n<div class=\"snippet-code\">\n<pre class=\"snippet-code-js lang-js prettyprint-override\"><code>var employee=[{\"firstName\":\"Zahir\",\"lastName\":\"Alam\",\"Age\":25,\"Company\":\"Switchme\",\"Role\":\"Developer\",\"Department\":\"Tech\",\"Head\":{\"Id\":3,\"Name\":\"Sourasis Roy\"}},{\"firstName\":\"Amith\",\"lastName\":\"Manniken\",\"Age\":25,\"Company\":\"Switchme\",\"Role\":\"Developer\",\"Department\":\"Tech\",\"Head\":{\"Id\":3,\"Name\":\"Sourasis Roy\"}},{\"firstName\":\"Sourasis\",\"lastName\":\"Roy\",\"Age\":28,\"Company\":\"Switchme\",\"Role\":\"CTO\"},{\"firstName\":\"Aditya\",\"lastName\":\"Mishra\",\"Age\":29,\"Company\":\"Switchme\",\"Department\":\"Tech\",\"Role\":\"CEO\"},{\"firstName\":\"Priti\",\"lastName\":\"Lata\",\"Age\":24,\"Company\":\"Switchme\",\"Role\":\"HR\"},{\"firstName\":\"Sumita\",\"lastName\":\"Nath\",\"Age\":24,\"Company\":\"Switchme\",\"Role\":\"HLA Head\",\"Department\":\"Crm\"},{\"firstName\":\"Tarini\",\"lastName\":\"Khanna\",\"Age\":22,\"Company\":\"Switchme\",\"Role\":\"Content Writer\"},{\"firstName\":\"Abhisek\",\"lastName\":\"Soni\",\"Age\":23,\"Company\":\"Switchme\",\"Role\":\"HLA\",\"Department\":\"Crm\",\"Head\":{\"Id\":5,\"Name\":\"Sumita Nath\"}},{\"firstName\":\"Ankit\",\"lastName\":\"Pump\",\"Age\":23,\"Company\":\"Switchme\",\"Role\":\"HLA\",\"Department\":\"Crm\",\"Head\":{\"Id\":5,\"Name\":\"Sumita Nath\"}},{\"firstName\":\"Pogo\",\"lastName\":\"Laal\",\"Age\":23,\"Company\":\"Switchme\",\"Role\":\"Designer\"},{\"firstName\":\"Sabina\",\"lastName\":\"Sekh\",\"Age\":28,\"Company\":\"Switchme\",\"Role\":\"HLA Head\",\"Department\":\"Crm\"},{\"firstName\":\"Sanjay\",\"lastName\":\"Poudal\",\"Age\":24,\"Company\":\"Switchme\",\"Role\":\"HLA Head\",\"Department\":\"Crm\",\"Head\":{\"Id\":10,\"Name\":\"Sabina Sekh\"}}];\r\nvar repeated = [...new Set(employee.map(({ Department }) =&gt; Department).filter(Boolean))];\r\n$(\"div.all\").text(repeated.join(\", \"));<\/code><\/pre>\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code>&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.3.1.js\"&gt;&lt;\/script&gt;\r\n&lt;h3&gt;2. List out all department name &lt;\/h3&gt;\r\n&lt;div class=\"all\"&gt;&lt;\/div&gt;<\/code><\/pre>\n<\/div>\n<\/div><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">7<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved I want to print only the repeated values once from an associative array <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Use filter and map, with a Set to remove the repeated values: var employee=[{&#8220;firstName&#8221;:&#8221;Zahir&#8221;,&#8221;lastName&#8221;:&#8221;Alam&#8221;,&#8221;Age&#8221;:25,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;Developer&#8221;,&#8221;Department&#8221;:&#8221;Tech&#8221;,&#8221;Head&#8221;:{&#8220;Id&#8221;:3,&#8221;Name&#8221;:&#8221;Sourasis Roy&#8221;}},{&#8220;firstName&#8221;:&#8221;Amith&#8221;,&#8221;lastName&#8221;:&#8221;Manniken&#8221;,&#8221;Age&#8221;:25,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;Developer&#8221;,&#8221;Department&#8221;:&#8221;Tech&#8221;,&#8221;Head&#8221;:{&#8220;Id&#8221;:3,&#8221;Name&#8221;:&#8221;Sourasis Roy&#8221;}},{&#8220;firstName&#8221;:&#8221;Sourasis&#8221;,&#8221;lastName&#8221;:&#8221;Roy&#8221;,&#8221;Age&#8221;:28,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;CTO&#8221;},{&#8220;firstName&#8221;:&#8221;Aditya&#8221;,&#8221;lastName&#8221;:&#8221;Mishra&#8221;,&#8221;Age&#8221;:29,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Department&#8221;:&#8221;Tech&#8221;,&#8221;Role&#8221;:&#8221;CEO&#8221;},{&#8220;firstName&#8221;:&#8221;Priti&#8221;,&#8221;lastName&#8221;:&#8221;Lata&#8221;,&#8221;Age&#8221;:24,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;HR&#8221;},{&#8220;firstName&#8221;:&#8221;Sumita&#8221;,&#8221;lastName&#8221;:&#8221;Nath&#8221;,&#8221;Age&#8221;:24,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;HLA Head&#8221;,&#8221;Department&#8221;:&#8221;Crm&#8221;},{&#8220;firstName&#8221;:&#8221;Tarini&#8221;,&#8221;lastName&#8221;:&#8221;Khanna&#8221;,&#8221;Age&#8221;:22,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;Content Writer&#8221;},{&#8220;firstName&#8221;:&#8221;Abhisek&#8221;,&#8221;lastName&#8221;:&#8221;Soni&#8221;,&#8221;Age&#8221;:23,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;HLA&#8221;,&#8221;Department&#8221;:&#8221;Crm&#8221;,&#8221;Head&#8221;:{&#8220;Id&#8221;:5,&#8221;Name&#8221;:&#8221;Sumita Nath&#8221;}},{&#8220;firstName&#8221;:&#8221;Ankit&#8221;,&#8221;lastName&#8221;:&#8221;Pump&#8221;,&#8221;Age&#8221;:23,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;HLA&#8221;,&#8221;Department&#8221;:&#8221;Crm&#8221;,&#8221;Head&#8221;:{&#8220;Id&#8221;:5,&#8221;Name&#8221;:&#8221;Sumita Nath&#8221;}},{&#8220;firstName&#8221;:&#8221;Pogo&#8221;,&#8221;lastName&#8221;:&#8221;Laal&#8221;,&#8221;Age&#8221;:23,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;Designer&#8221;},{&#8220;firstName&#8221;:&#8221;Sabina&#8221;,&#8221;lastName&#8221;:&#8221;Sekh&#8221;,&#8221;Age&#8221;:28,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;HLA Head&#8221;,&#8221;Department&#8221;:&#8221;Crm&#8221;},{&#8220;firstName&#8221;:&#8221;Sanjay&#8221;,&#8221;lastName&#8221;:&#8221;Poudal&#8221;,&#8221;Age&#8221;:24,&#8221;Company&#8221;:&#8221;Switchme&#8221;,&#8221;Role&#8221;:&#8221;HLA Head&#8221;,&#8221;Department&#8221;:&#8221;Crm&#8221;,&#8221;Head&#8221;:{&#8220;Id&#8221;:10,&#8221;Name&#8221;:&#8221;Sabina Sekh&#8221;}}]; var repeated = [&#8230;new Set(employee.map(({ Department }) =&gt; Department).filter(Boolean))]; $(&#8220;div.all&#8221;).text(repeated.join(&#8220;, &#8220;)); &lt;script src=&#8221;https:\/\/code.jquery.com\/jquery-3.3.1.js&#8221;&gt;&lt;\/script&gt; &lt;h3&gt;2. List out all department name &lt;\/h3&gt; &lt;div class=&#8221;all&#8221;&gt;&lt;\/div&gt; 7 [ad_2] solved I want to print only the &#8230; <a title=\"[Solved] I want to print only the repeated values once from an associative array\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\" aria-label=\"More on [Solved] I want to print only the repeated values once from an associative array\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[361,346,333,388,430],"class_list":["post-8102","post","type-post","status-publish","format-standard","hentry","category-solved","tag-arrays","tag-html","tag-javascript","tag-jquery","tag-object"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] I want to print only the repeated values once from an associative array - JassWeb<\/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:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] I want to print only the repeated values once from an associative array - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Use filter and map, with a Set to remove the repeated values: var employee=[{&quot;firstName&quot;:&quot;Zahir&quot;,&quot;lastName&quot;:&quot;Alam&quot;,&quot;Age&quot;:25,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;Developer&quot;,&quot;Department&quot;:&quot;Tech&quot;,&quot;Head&quot;:{&quot;Id&quot;:3,&quot;Name&quot;:&quot;Sourasis Roy&quot;}},{&quot;firstName&quot;:&quot;Amith&quot;,&quot;lastName&quot;:&quot;Manniken&quot;,&quot;Age&quot;:25,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;Developer&quot;,&quot;Department&quot;:&quot;Tech&quot;,&quot;Head&quot;:{&quot;Id&quot;:3,&quot;Name&quot;:&quot;Sourasis Roy&quot;}},{&quot;firstName&quot;:&quot;Sourasis&quot;,&quot;lastName&quot;:&quot;Roy&quot;,&quot;Age&quot;:28,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;CTO&quot;},{&quot;firstName&quot;:&quot;Aditya&quot;,&quot;lastName&quot;:&quot;Mishra&quot;,&quot;Age&quot;:29,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Department&quot;:&quot;Tech&quot;,&quot;Role&quot;:&quot;CEO&quot;},{&quot;firstName&quot;:&quot;Priti&quot;,&quot;lastName&quot;:&quot;Lata&quot;,&quot;Age&quot;:24,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;HR&quot;},{&quot;firstName&quot;:&quot;Sumita&quot;,&quot;lastName&quot;:&quot;Nath&quot;,&quot;Age&quot;:24,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;HLA Head&quot;,&quot;Department&quot;:&quot;Crm&quot;},{&quot;firstName&quot;:&quot;Tarini&quot;,&quot;lastName&quot;:&quot;Khanna&quot;,&quot;Age&quot;:22,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;Content Writer&quot;},{&quot;firstName&quot;:&quot;Abhisek&quot;,&quot;lastName&quot;:&quot;Soni&quot;,&quot;Age&quot;:23,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;HLA&quot;,&quot;Department&quot;:&quot;Crm&quot;,&quot;Head&quot;:{&quot;Id&quot;:5,&quot;Name&quot;:&quot;Sumita Nath&quot;}},{&quot;firstName&quot;:&quot;Ankit&quot;,&quot;lastName&quot;:&quot;Pump&quot;,&quot;Age&quot;:23,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;HLA&quot;,&quot;Department&quot;:&quot;Crm&quot;,&quot;Head&quot;:{&quot;Id&quot;:5,&quot;Name&quot;:&quot;Sumita Nath&quot;}},{&quot;firstName&quot;:&quot;Pogo&quot;,&quot;lastName&quot;:&quot;Laal&quot;,&quot;Age&quot;:23,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;Designer&quot;},{&quot;firstName&quot;:&quot;Sabina&quot;,&quot;lastName&quot;:&quot;Sekh&quot;,&quot;Age&quot;:28,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;HLA Head&quot;,&quot;Department&quot;:&quot;Crm&quot;},{&quot;firstName&quot;:&quot;Sanjay&quot;,&quot;lastName&quot;:&quot;Poudal&quot;,&quot;Age&quot;:24,&quot;Company&quot;:&quot;Switchme&quot;,&quot;Role&quot;:&quot;HLA Head&quot;,&quot;Department&quot;:&quot;Crm&quot;,&quot;Head&quot;:{&quot;Id&quot;:10,&quot;Name&quot;:&quot;Sabina Sekh&quot;}}]; var repeated = [...new Set(employee.map(({ Department }) =&gt; Department).filter(Boolean))]; $(&quot;div.all&quot;).text(repeated.join(&quot;, &quot;)); &lt;script src=&quot;https:\/\/code.jquery.com\/jquery-3.3.1.js&quot;&gt;&lt;\/script&gt; &lt;h3&gt;2. List out all department name &lt;\/h3&gt; &lt;div class=&quot;all&quot;&gt;&lt;\/div&gt; 7 [ad_2] solved I want to print only the ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-11T18:04:59+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] I want to print only the repeated values once from an associative array\",\"datePublished\":\"2022-09-11T18:04:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\"},\"wordCount\":39,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"arrays\",\"html\",\"javascript\",\"jquery\",\"object\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\",\"name\":\"[Solved] I want to print only the repeated values once from an associative array - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-09-11T18:04:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] I want to print only the repeated values once from an associative array\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] I want to print only the repeated values once from an associative array - JassWeb","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:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] I want to print only the repeated values once from an associative array - JassWeb","og_description":"[ad_1] Use filter and map, with a Set to remove the repeated values: var employee=[{\"firstName\":\"Zahir\",\"lastName\":\"Alam\",\"Age\":25,\"Company\":\"Switchme\",\"Role\":\"Developer\",\"Department\":\"Tech\",\"Head\":{\"Id\":3,\"Name\":\"Sourasis Roy\"}},{\"firstName\":\"Amith\",\"lastName\":\"Manniken\",\"Age\":25,\"Company\":\"Switchme\",\"Role\":\"Developer\",\"Department\":\"Tech\",\"Head\":{\"Id\":3,\"Name\":\"Sourasis Roy\"}},{\"firstName\":\"Sourasis\",\"lastName\":\"Roy\",\"Age\":28,\"Company\":\"Switchme\",\"Role\":\"CTO\"},{\"firstName\":\"Aditya\",\"lastName\":\"Mishra\",\"Age\":29,\"Company\":\"Switchme\",\"Department\":\"Tech\",\"Role\":\"CEO\"},{\"firstName\":\"Priti\",\"lastName\":\"Lata\",\"Age\":24,\"Company\":\"Switchme\",\"Role\":\"HR\"},{\"firstName\":\"Sumita\",\"lastName\":\"Nath\",\"Age\":24,\"Company\":\"Switchme\",\"Role\":\"HLA Head\",\"Department\":\"Crm\"},{\"firstName\":\"Tarini\",\"lastName\":\"Khanna\",\"Age\":22,\"Company\":\"Switchme\",\"Role\":\"Content Writer\"},{\"firstName\":\"Abhisek\",\"lastName\":\"Soni\",\"Age\":23,\"Company\":\"Switchme\",\"Role\":\"HLA\",\"Department\":\"Crm\",\"Head\":{\"Id\":5,\"Name\":\"Sumita Nath\"}},{\"firstName\":\"Ankit\",\"lastName\":\"Pump\",\"Age\":23,\"Company\":\"Switchme\",\"Role\":\"HLA\",\"Department\":\"Crm\",\"Head\":{\"Id\":5,\"Name\":\"Sumita Nath\"}},{\"firstName\":\"Pogo\",\"lastName\":\"Laal\",\"Age\":23,\"Company\":\"Switchme\",\"Role\":\"Designer\"},{\"firstName\":\"Sabina\",\"lastName\":\"Sekh\",\"Age\":28,\"Company\":\"Switchme\",\"Role\":\"HLA Head\",\"Department\":\"Crm\"},{\"firstName\":\"Sanjay\",\"lastName\":\"Poudal\",\"Age\":24,\"Company\":\"Switchme\",\"Role\":\"HLA Head\",\"Department\":\"Crm\",\"Head\":{\"Id\":10,\"Name\":\"Sabina Sekh\"}}]; var repeated = [...new Set(employee.map(({ Department }) =&gt; Department).filter(Boolean))]; $(\"div.all\").text(repeated.join(\", \")); &lt;script src=\"https:\/\/code.jquery.com\/jquery-3.3.1.js\"&gt;&lt;\/script&gt; &lt;h3&gt;2. List out all department name &lt;\/h3&gt; &lt;div class=\"all\"&gt;&lt;\/div&gt; 7 [ad_2] solved I want to print only the ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/","og_site_name":"JassWeb","article_published_time":"2022-09-11T18:04:59+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] I want to print only the repeated values once from an associative array","datePublished":"2022-09-11T18:04:59+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/"},"wordCount":39,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["arrays","html","javascript","jquery","object"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/","url":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/","name":"[Solved] I want to print only the repeated values once from an associative array - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-09-11T18:04:59+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-i-want-to-print-only-the-repeated-values-once-from-an-associative-array\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] I want to print only the repeated values once from an associative array"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/8102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=8102"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/8102\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=8102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=8102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=8102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}