JS 依照元素出現數量排序
同樣是最近遇到的狀況,需要利用陣列內元素出現的數量進行排序,以下為範例程式:
var array = ["1", "2", "4", "5", "2", "4", "2", "3"]; var str = array.toString(); var filter = []; var result = []; document.write("原始陣列:" + array + "<br>"); var get = function (str, tar, arr, tmp) { if (str.indexOf(tar) >= 0) { tmp = str.slice(str.indexOf(tar) + 1); arr.push(tar); get(tmp, tar, arr, tmp); } return arr; } for (i in array) { var elm = []; var tmp; var fstr = filter.join(); if (fstr.indexOf(array[i]) >= 0) { continue; } else { var tmp_arr = get(str, array[i], elm, tmp); result.push(tmp_arr.length + ':' + tmp_arr[0]); filter.push(array[i]); } } result.sort(); result.reverse(); //按照出現次數排序,不刪除重複元素 var finishArray = []; for (index in result) { var show = result[index].split(':'); for (i = 0; i < show[0]; i++) { finishArray.push(show[1]); } } document.write("按出現次數排序,不刪除重複元素:" + finishArray + "<br>"); //按照出現次數排序,刪除重複元素 var finishArray = []; for (index in result) { var show = result[index].split(':'); finishArray.push(show[1]); } document.write("按出現次數排序,刪除重複元素:" + finishArray + "<br>");
輸出結果:
原始陣列:1,2,4,5,2,4,2,3 按出現次數排序,不刪除重複元素:2,2,2,4,4,5,3,1 按出現次數排序,刪除重複元素:2,4,5,3,1
казино Рокс
https://moskvic.actieforum.com/t4151-topic#7486
пин ап: https://pinupkz.life/
online pharmacy no prescriptions
Mostbet brings you an unparalleled online gaming experience with its official website and Mostbet app . Whether you choose to gamble on your computer or tablet, the Mostbet app download ensures seamless access to thrilling gambling features and sports betting . Don’t miss out on the convenience of the Mostbet mobile file for Android users , providing fast and easy installation . Start your adventure today by logging in or registering !
Step into the Mostbet gambling site in Bangladesh! Experience a uninterrupted betting adventure with a vast selection of exciting games and opportunities. Mobile App for Mostbet : Play your top betting options on the go by installing the mobile app . Designed for mobile users, the app ensures a secure and safe gaming experience . Sign in to Mostbet: Easily log in to your account using your credentials . If you haven’t signed up yet, registering is easy and hassle-free .
Link: https://youthandfamily.org.au/mostbet-casino-login-official-website-and-online-casino-guide/
Mostbet APK : For Android device owners, the APK installation ensures a quick and hassle-free installation process . Ensure you download the latest version for the smoothest experience . Be part of the global community who rely on Mostbet for their gambling adventures . Whether you enjoy reel-based games, table games , or live dealer experiences, Mostbet caters to all players. Go to the Mostbet gaming portal. Register or sign into Mostbet.
Browse the numerous gaming choices.
Get the Mostbet mobile version for seamless gameplay.
Make the most of the fun ! Begin your adventure with Mostbet today and dive into high-quality online casino entertainment in Bangladesh.
Ignorance about the expenses of outsiders persons –
When carrying out business in area real estate we often pay great attention to obvious expenses,
like agent fees, legal Bella Staging, and expenses for
purchase apartments.
dark market list darknet markets onion address
пин ап: https://pinupkz.life/
пин ап вход: https://pinupkz.life/
1 win. https://fanfiction.borda.ru/?1-0-0-00029708-000-0-0-1743051664/ .
пин ап зеркало – пин ап казино официальный сайт
Our platform brings you an unparalleled online gaming experience with its main platform and mobile application . Whether you prefer to gamble on your desktop or tablet, the app installation ensures easy entry to engaging betting options and sports betting . Don’t miss out on the convenience of the Mostbet mobile file for Android device owners, ensuring quick and straightforward setup . Start your gaming experience today by signing into your account or signing up !
Step into the Mostbet gambling site in Bangladesh! Experience a smooth gaming experience with a large variety of exciting games and features . Get the Mostbet Application: Access your favorite betting options on the go by downloading the Mostbet app . Designed for mobile users, the app provides a secure and protected gaming experience . Sign in to Mostbet: Easily log in to your account using your credentials . If you don’t have an account yet , registering is simple and straightforward .
Link: https://live123.tv/mostbet-casino-official-online-website-register-and-login-in-bangladesh/
APK for Mostbet: For Android users , the Mostbet APK file provides a easy and smooth installation process . Always check you download the latest version for the best performance . Join the millions of players who trust Mostbet for their online casino needs . Whether you enjoy slot machines , classic casino games, or real-time dealer games , Mostbet has it all . Visit the Mostbet main site . Register or sign into Mostbet.
Check out the exciting casino collection .
Get the Mostbet mobile version for mobile convenience .
Take advantage of the excitement ! Begin your adventure with Mostbet right away and dive into top-notch online casino entertainment in Bangladesh.
Virtual gambling platforms have transformed the gambling market, providing an exceptional degree of user-friendliness and variety that traditional establishments struggle to rival. Throughout the last ten years, a vast number of enthusiasts around the world have chosen the thrill of digital casino play in light of its always-open nature, exciting features, and continuously increasing catalogs of games.
If you’re just starting with the world of online gaming or are looking to find out more about reliable sites, why not join our active gaming forum? It’s a destination where gaming aficionados share tips, guiding you to get the most out of your gambling adventure. Dive into the experience and learn more now: http://pasarinko.zeroweb.kr/bbs/board.php?bo_table=notice&wr_id=4614379
One of the key draws of virtual gambling hubs is the unparalleled array of gaming experiences at your disposal. Whether you enjoy spinning classic one-armed bandits, immersing yourself in engaging modern slot games, or mastering skills in strategy-based games like Blackjack, casino websites feature countless opportunities. Plenty of operators furthermore offer interactive dealer games, enabling you to communicate with live hosts and other players, all while enjoying the authentic environment of a land-based casino from anywhere you want.
Beyond variety, online casinos excel availability.
Oh my goodness! Impressive article dude! Thanks, However I
am having issues with your RSS. I don’t know the reason why I
can’t subscribe to it. Is there anybody getting the same RSS problems?
Anyone that knows the answer will you kindly respond?
Thanx!!
пин ап зеркало – пин ап казино официальный сайт
пин ап казино официальный сайт – пин ап казино официальный сайт
Hey just wanted to give you a brief heads up and let you know
a few of the pictures aren’t loading properly. I’m not
sure why but I think its a linking issue.
I’ve tried it in two different web browsers and both show
the same results.
пин ап вход – пин ап казино зеркало
Hmm is anyone else experiencing problems with the images on this
blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog.
Any responses would be greatly appreciated.
мосбет казино https://cah.forum24.ru/?1-3-0-00000096-000-0-0-1743053764/ .
mostbet chrono https://assa0.myqip.ru/?1-23-0-00000149-000-0-0-1743053201/ .
пинап казино – пин ап зеркало
Mostbet provides an exceptional virtual casino adventure with its dedicated site and mobile application . Whether you enjoy to gamble on your laptop or smartphone , the Mostbet app download ensures uninterrupted gameplay to engaging casino games and betting opportunities. Don’t miss out on the ease of the Mostbet mobile file for Android device owners, enabling hassle-free and easy installation . Start your adventure today by signing into your account or registering !
Welcome the Mostbet gambling site in Bangladesh! Experience a seamless betting adventure with a large variety of thrilling games and features . Mobile App for Mostbet : Play your top casino games anywhere, anytime by downloading the official casino application. Available for both Android and iOS devices , the app guarantees a smooth and protected casino access. Sign in to Mostbet: Easily log in to your account using your account information. If you don’t have an account yet , signing up is easy and hassle-free .
Link: https://conocegsa.com/index.php/category/uncategorized/page/13/
Android Mostbet App : For those on Android , the Mostbet APK file ensures a quick and seamless download method . Always check you get the most updated file for the optimal gaming performance. Be part of the global community who rely on Mostbet for their online casino needs . Whether you enjoy slot machines , table games , or live dealer experiences, Mostbet has it all . Explore the Mostbet gaming portal. Sign up or log in .
Browse the exciting casino collection .
Install the mobile application for mobile convenience .
Take advantage of the thrill! Kick off your gaming experience with Mostbet today and dive into high-quality gaming excitement in Bangladesh.
I savor, cause I discovered just what I used to be taking a look for.
You’ve ended my 4 day long hunt! God Bless you
man. Have a nice day. Bye
Hey there! Do you know if they make any plugins to assist with Search Engine Optimization? I’m
trying to get my blog to rank for some targeted keywords but I’m not seeing very good
success. If you know of any please share. Thank you!
darkmarket link dark web market list
пин ап казино зеркало – пин ап казино официальный сайт
Generic Tadalafil 20mg price Tadalafil Easy Buy cheapest cialis
пин ап казино официальный сайт – пин ап казино официальный сайт
This blog was… how do you say it? Relevant!! Finally I’ve found something which helped me.
Thank you!