{"id":5492,"date":"2023-02-24T08:17:43","date_gmt":"2023-02-24T13:17:43","guid":{"rendered":"https:\/\/www.cloudsurph.com\/?p=5492"},"modified":"2023-02-24T08:18:40","modified_gmt":"2023-02-24T13:18:40","slug":"sorting-arrays-in-javascript","status":"publish","type":"post","link":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/","title":{"rendered":"Sorting Arrays in JavaScript"},"content":{"rendered":"<p>In this article, we try to learn how can I sort an array in JavaScript, how to sort arrays from lowest to highest in JavaScript, how do you sort arrays, and how to sort arrays by name in JavaScript.<\/p>\n<h2>Sorting Arrays in JavaScript<\/h2>\n<p>Firstly, JavaScript is conveniently coming with a built-in method for sorting arrays and while the end result is the same, the various JavaScript engines implement this method using different sort algorithms like Quicksort or Insertion Sort, Merge sort, or Selection Sort.<\/p>\n<p>So, this sort function is available as a prototype method on the <strong>array<\/strong> class like the below code:<\/p>\n<pre class=\"prettyprint\">\r\nArray.sort([compareFunc])\r\n<\/pre>\n<h3>The <strong>compareFunc<\/strong> should have two parameters, <strong>a<\/strong> and <strong>b<\/strong>, and works like this below:<\/h3>\n<p>Firstly, if <strong>compareFunc<\/strong> returns 0 then the elements are treated as equal<\/p>\n<p>Secondly, if <strong>compareFunc<\/strong> returns 1 then<strong> b<\/strong> is sorted before<strong> a<\/strong><\/p>\n<p>Thirdly, if <strong>compareFunc<\/strong> returns <strong>-1<\/strong> then <strong>a<\/strong> is sorted before <strong>b<\/strong><\/p>\n<h5><em><strong>If you want then buy a good, reliable, secure web\u00a0<a href=\"https:\/\/www.cloudsurph.com\/windows-vps-hosting\/\">hosting<\/a>\u00a0service \u00a0from here:\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">click here<\/a><\/strong><\/em><\/h5>\n<p>Hence, if the <strong>compareFunc<\/strong> is not given then the elements are converted to strings and then sorted alphabetically.<\/p>\n<h4>However, while sorting numbers seems like it should be straightforward, it can actually be a bit confusing like the below:<\/h4>\n<pre class=\"prettyprint\">\r\n&gt; let nums = [3, 2, 6, 50, 10];\r\n&gt; nums.sort()\r\n[ 10, 2, 3, 50, 6 ]\r\n<\/pre>\n<h3>Previous JavaScript Articles<\/h3>\n<ul>\n<li><a href=\"https:\/\/www.cloudsurph.com\/javascript-variables\/\" aria-current=\"page\">JavaScript Variables<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/javascript-operators\/\">JavaScript Operators<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/creating-an-object-in-javascript\/\">Creating an Object in JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/what-is-asynchronous-javascript\/\">Introduction to Asynchronous JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/what-is-control-flow-in-javascript\/\">Control Flow in JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/how-to-use-regex-in-javascript-function\/\">What is JavaScript Regex?<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/javascript-events-example\/\" aria-current=\"page\">JavaScript Events Example<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/how-to-create-a-preloader-in-javascript\/\" aria-current=\"page\">How to create a preloader in JavaScript?<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/foreach-method-in-javascript\/\" aria-current=\"page\">forEach method in JavaScript<\/a><\/li>\n<\/ul>\n<p>As you can see, the numbers aren&#8217;t in the order you would have expected, and as a string, &#8220;50&#8221; comes before &#8220;6&#8221;, which is why 50 isn&#8217;t last in the array. To sort this array correctly, try the following instead code below:<\/p>\n<pre class=\"prettyprint\">\r\n&gt; let nums = [3, 2, 6, 50, 10];\r\n&gt; nums.sort((a, b) =&gt; a - b);\r\n[ 2, 3, 6, 10, 50 ]\r\n<\/pre>\n<h5><em><strong>You can purchase your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting from Cloudsurph.com<\/a>,\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">Cloudsurph hosting<\/a>\u00a0is a reliable hosting option for business and personal projects. We offer insight and help on system configuration issues and code errors or bugs<\/strong>.<\/em><\/h5>\n<p>So, if you want to reverse the order of the sorting, you need to just switch around the comparison of a and b. Hence, if we want the numbers to be in descending order, you can do the following code:<\/p>\n<pre class=\"prettyprint\">\r\n&gt; let nums = [3, 2, 6, 50, 10];\r\n&gt; nums.sort((a, b) =&gt; b - a);\r\n[ 50, 10, 6, 3, 2 ]\r\n<\/pre>\n<h3>Sorting Array of Objects<\/h3>\n<p>Basically, JavaScript using a comparator function like this makes it extremely easy to sort custom objects. Let\u2019s say we have the following list of user data example:<\/p>\n<pre class=\"prettyprint\">\r\nlet users = [\r\n{name: 'Scott', age: '18'},\r\n{name: 'Tom', age: '21'},\r\n{name: 'Sally', age: '71'},\r\n{name: 'Billy', age: '18'},\r\n{name: 'Tim', age: '21'}\r\n];\r\n<\/pre>\n<p>In this case, the order also highly depends on the application and we could provide a comparator that combines the two like the below:<\/p>\n<pre class=\"prettyprint\">\r\nusers.sort((a, b) =&gt; {\r\nlet keyA = a.age + a.name;\r\nlet keyB = b.age + b.name;\r\nif (keyA &lt; keyB) return -1;\r\nif (keyA &gt; keyB) return 1;\r\nreturn 0;\r\n});\r\n<\/pre>\n<h5>And as the result will be like a sorted array:<\/h5>\n<pre class=\"prettyprint\">\r\n[ { name: 'Billy', age: '18' },\r\n{ name: 'Scott', age: '18' },\r\n{ name: 'Tim', age: '21' },\r\n{ name: 'Tom', age: '21' },\r\n{ name: 'Sally', age: '71' } ]\r\n<\/pre>\n<p>Finally, we saw how to use the <strong>built-in .sort()<\/strong> method to easily sort arrays and applies to any type of data, including strings, numbers, or even objects in JavaScript<\/p>\n<p>So, the sort order is determined by the <strong>compareFun<\/strong> callback method, which is what allows you to determine the sort order or what object properties determine the sort order.<\/p>\n<p>That\u2019s it. If you enjoyed reading this article and have more questions please reach out to our\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/submitticket.php?step=2&amp;deptid=1\">support team<\/a>\u00a0via live chat or\u00a0<a href=\"mailto:support@cloudsurph.com\">email<\/a>\u00a0and we would be glad to help you. we provide server\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting<\/a>\u00a0for all types of need and we can even get your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">server<\/a>\u00a0up and running with the service of your choice.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we try to learn how can I sort an array in JavaScript, how to sort arrays from lowest to highest in JavaScript, how do you sort arrays, and how to sort arrays by name in JavaScript. Sorting Arrays in JavaScript Firstly, JavaScript is conveniently coming with a built-in method for sorting arrays [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":5493,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[157,25,162,159,44,1,31],"tags":[54,47,105,103,48,113],"class_list":["post-5492","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7","category-web-hosting-virtualization","category-javascript","category-linux-server","category-kvm-xen","category-virtual-private-servers","category-web-hosting","tag-best-vps-hosting-server-maryland","tag-cheap-cloud-servers","tag-cheap-storage-server-hosting","tag-cheapest-vps","tag-dedicated-server-hosting-in-washington-d-c","tag-speed-test-vps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Sorting Arrays in JavaScript<\/title>\n<meta name=\"description\" content=\"Sorting Arrays in JavaScript, JavaScript Array sort() Method, How do you sort arrays, How can I sort array in JavaScript\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sorting Arrays in JavaScript\" \/>\n<meta property=\"og:description\" content=\"Sorting Arrays in JavaScript, JavaScript Array sort() Method, How do you sort arrays, How can I sort array in JavaScript\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudsurph Web Hosting Washington D.C.\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/CloudSurph\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-24T13:17:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-24T13:18:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/Sorting-Arrays-in-JavaScript.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1264\" \/>\n\t<meta property=\"og:image:height\" content=\"760\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rony\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cloudsurph\" \/>\n<meta name=\"twitter:site\" content=\"@Cloud_Surph\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rony\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/\"},\"author\":{\"name\":\"Rony\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\"},\"headline\":\"Sorting Arrays in JavaScript\",\"datePublished\":\"2023-02-24T13:17:43+00:00\",\"dateModified\":\"2023-02-24T13:18:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/\"},\"wordCount\":541,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Sorting-Arrays-in-JavaScript.jpg\",\"keywords\":[\"Best VPS hosting server Maryland\",\"Cheap Cloud Servers\",\"Cheap Storage Server Hosting\",\"Cheapest VPS\",\"Dedicated Server Hosting in Washington D.C\",\"Speed test VPS\"],\"articleSection\":[\"CentOS 7\",\"Cloud Hosting\",\"JavaScript\",\"Linux Server\",\"Virtualization\",\"VPS Servers\",\"Web Hosting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/\",\"name\":\"Sorting Arrays in JavaScript\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Sorting-Arrays-in-JavaScript.jpg\",\"datePublished\":\"2023-02-24T13:17:43+00:00\",\"dateModified\":\"2023-02-24T13:18:40+00:00\",\"description\":\"Sorting Arrays in JavaScript, JavaScript Array sort() Method, How do you sort arrays, How can I sort array in JavaScript\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Sorting-Arrays-in-JavaScript.jpg\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Sorting-Arrays-in-JavaScript.jpg\",\"width\":1264,\"height\":760},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/sorting-arrays-in-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cloudsurph.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sorting Arrays in JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"name\":\"Cloudsurph Web Hosting Washington D.C.\",\"description\":\"Dedicated Server Hosting\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cloudsurph.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\",\"name\":\"CloudSurph Technology Solutions\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"width\":2348,\"height\":1692,\"caption\":\"CloudSurph Technology Solutions\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/CloudSurph\\\/\",\"https:\\\/\\\/x.com\\\/Cloud_Surph\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\",\"name\":\"Rony\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"caption\":\"Rony\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/cloudsurph\"],\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/author\\\/ron\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sorting Arrays in JavaScript","description":"Sorting Arrays in JavaScript, JavaScript Array sort() Method, How do you sort arrays, How can I sort array in JavaScript","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:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Sorting Arrays in JavaScript","og_description":"Sorting Arrays in JavaScript, JavaScript Array sort() Method, How do you sort arrays, How can I sort array in JavaScript","og_url":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/","og_site_name":"Cloudsurph Web Hosting Washington D.C.","article_publisher":"https:\/\/www.facebook.com\/CloudSurph\/","article_published_time":"2023-02-24T13:17:43+00:00","article_modified_time":"2023-02-24T13:18:40+00:00","og_image":[{"width":1264,"height":760,"url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/Sorting-Arrays-in-JavaScript.jpg","type":"image\/jpeg"}],"author":"Rony","twitter_card":"summary_large_image","twitter_creator":"@cloudsurph","twitter_site":"@Cloud_Surph","twitter_misc":{"Written by":"Rony","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/#article","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/"},"author":{"name":"Rony","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed"},"headline":"Sorting Arrays in JavaScript","datePublished":"2023-02-24T13:17:43+00:00","dateModified":"2023-02-24T13:18:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/"},"wordCount":541,"publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"image":{"@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/Sorting-Arrays-in-JavaScript.jpg","keywords":["Best VPS hosting server Maryland","Cheap Cloud Servers","Cheap Storage Server Hosting","Cheapest VPS","Dedicated Server Hosting in Washington D.C","Speed test VPS"],"articleSection":["CentOS 7","Cloud Hosting","JavaScript","Linux Server","Virtualization","VPS Servers","Web Hosting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/","url":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/","name":"Sorting Arrays in JavaScript","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/Sorting-Arrays-in-JavaScript.jpg","datePublished":"2023-02-24T13:17:43+00:00","dateModified":"2023-02-24T13:18:40+00:00","description":"Sorting Arrays in JavaScript, JavaScript Array sort() Method, How do you sort arrays, How can I sort array in JavaScript","breadcrumb":{"@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/#primaryimage","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/Sorting-Arrays-in-JavaScript.jpg","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/Sorting-Arrays-in-JavaScript.jpg","width":1264,"height":760},{"@type":"BreadcrumbList","@id":"https:\/\/www.cloudsurph.com\/sorting-arrays-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cloudsurph.com\/"},{"@type":"ListItem","position":2,"name":"Sorting Arrays in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.cloudsurph.com\/#website","url":"https:\/\/www.cloudsurph.com\/","name":"Cloudsurph Web Hosting Washington D.C.","description":"Dedicated Server Hosting","publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cloudsurph.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.cloudsurph.com\/#organization","name":"CloudSurph Technology Solutions","url":"https:\/\/www.cloudsurph.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","width":2348,"height":1692,"caption":"CloudSurph Technology Solutions"},"image":{"@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/CloudSurph\/","https:\/\/x.com\/Cloud_Surph"]},{"@type":"Person","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed","name":"Rony","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","caption":"Rony"},"sameAs":["https:\/\/x.com\/cloudsurph"],"url":"https:\/\/www.cloudsurph.com\/author\/ron\/"}]}},"_links":{"self":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/comments?post=5492"}],"version-history":[{"count":2,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5492\/revisions"}],"predecessor-version":[{"id":5495,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5492\/revisions\/5495"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media\/5493"}],"wp:attachment":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media?parent=5492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/categories?post=5492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/tags?post=5492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}