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
MexicanPharmInter: mexican pharmacy online order – mexican pharmacy online
buying from online mexican pharmacy: mexican drug stores online – Mexican Pharm International
dark web market links https://github.com/darkwebsitesyhshv/darkwebsites – darknet marketplace
You need to be a part of a contest for one of the highest quality sites on the net.
I will highly recommend this site!
https://indiamedfast.shop/# buying prescription drugs from india
best canadian online pharmacy
legal canadian pharmacy online: certified canada pharmacy online – legitimate canadian mail order pharmacy
buy viagra online
http://indiamedfast.com/# IndiaMedFast.com
canadian pharmacy
canadian family pharmacy: online canadian pharmacy no prescription – pet meds without vet prescription canada
“Failure is a great teacher and, if you are open to it, every mistake has a lesson to offer.” —Oprah Winfrey??????
http://mexicanpharminter.com/# MexicanPharmInter
Мы изготавливаем дипломы психологов, юристов, экономистов и других профессий по приятным ценам. Плюсы приобретения документов у нас
Вы заказываете диплом в надежной и проверенной компании. Это решение позволит вам сэкономить не только денежные средства, но и время.
Преимуществ куда больше:
• Дипломы делаем на настоящих бланках со всеми отметками;
• Можно приобрести дипломы любого ВУЗа РФ;
• Цена в разы меньше чем довелось бы заплатить на очном и заочном обучении в университете;
• Удобная доставка в любые регионы РФ.
Приобрести диплом о высшем образовании– http://zuhookanak.copiny.com/question/details/id/1061106/ – zuhookanak.copiny.com/question/details/id/1061106
Thanks for your marvelous posting! I definitely enjoyed reading it, you
will be a great author. I will make sure to bookmark
your blog and may come back in the future. I want to encourage you to ultimately continue your
great work, have a nice evening!
online medicine shopping in india: online pharmacy india – IndiaMedFast.com
dark market https://github.com/aresonioncq0a7/aresonion – dark market url
canadian pharmacy scam Pharmacies in Canada that ship to the US canadian online drugs
Mexican Pharm Inter: buying from online mexican pharmacy – Mexican Pharm International
I think the admin of this web page is really working hard in favor of
his web site, as here every stuff is quality
based material.
Hey there! This post could not be written any better!
Reading through this post reminds me of my old room mate!
He always kept chatting about this. I will forward this article
to him. Pretty sure he will have a good read.
Thank you for sharing!
my canadian pharmacy: most trusted canadian pharmacies online – cheap canadian pharmacy
http://interpharmonline.com/# canadian pharmacy ed medications
pharmacy canadian superstore
Mexican Pharm International: mexican pharmacy online store – Mexican Pharm International
Il a une durГ©e de conservation de deux ans sous forme solide et de cinq ans sous forme liquide. Lafon en 1976. Le modafinil est un mГ©dicament sur ordonnance utilisГ© pour traiter la somnolence diurne excessive et la somnolence excessive associГ©e au trouble du travail postГ©. Le modafinil est composГ© du composГ© chimique adrafinil, Г©galement connu sous le nom de 2-[(diphГ©nylmГ©thyl)sulfinyl – acГ©tamide, ou DMP-300. Bien qu’il ait un profil d’innocuitГ© Г©tendu, il est utilisГ© comme traitement de la somnolence causГ©e par la narcolepsie, les troubles du sommeil liГ©s au travail postГ©, l’apnГ©e obstructive du sommeil et le manque d’Г©nergie. Initialement dГ©veloppГ© dans les annГ©es 1970 par le neuroscientifique franГ§ais Michel Jouvet et les Laboratoires Lafon, le modafinil est prescrit en France depuis 1994 et a Г©tГ© approuvГ© pour un usage mГ©dical aux Г‰tats-Unis en 1998. Le modafinil peut ГЄtre administrГ© Г des doses allant jusqu’Г 1200 mg/jour, bien qu’il ne faille pas prendre plus de 300 mg en une seule dose. En tant que tel, ses effets sont similaires Г ceux de l’amphГ©tamine et du mГ©thylphГ©nidate et sont mГ©diГ©s par la liaison du mГ©dicament aux transporteurs de dopamine sur les membranes cellulaires, ce qui entraГ®ne une augmentation des niveaux intracellulaires de dopamine et d’autres neurotransmetteurs, notamment la sГ©rotonine, la noradrГ©naline et l’acГ©tylcholine. Il a Г©galement Г©tГ© suggГ©rГ© que le modafinil a des effets anti-inflammatoires, y compris la suppression des cytokines, de l’interfГ©ron-alpha et du facteur de nГ©crose tumorale alpha (TNF-alpha) qui sont impliquГ©s dans plusieurs processus inflammatoires. Le modafinil doit ГЄtre administrГ© 1 heure avant le dГ©but du sommeil. Le modafinil est gГ©nГ©ralement bien tolГ©rГ©, avec des effets secondaires possibles, notamment des maux de tГЄte, des troubles du sommeil et des nausГ©es. https://nootropiquepharmacie.com/comment-se-procurer-du-modafinil/ Il est conseillГ© aux utilisateurs de modafinil de le prendre Г la mГЄme heure chaque jour et d’Г©viter d’autres stimulants jusqu’Г ce que leurs symptГґmes se soient attГ©nuГ©s. Le modafinil est gГ©nГ©ralement bien tolГ©rГ© et a peu d’effets secondaires graves. Cela permettra environ deux semaines de vigilance continue avec une dose quotidienne de 800 mg. Un vaste essai contrГґlГ© randomisГ© a montrГ© qu’il est efficace dans le traitement de la somnolence excessive chez les personnes atteintes de narcolepsie. Le nombre d’atomes du cycle benzodioxane est de 8 et le nombre d’atomes du cycle pipГ©ridine est de 13. Le DL-modafinil est fabriquГ© par trois fournisseurs dans des usines pharmaceutiques approuvГ©es par la FDA. Le modafinil doit ГЄtre pris le matin aprГЁs une nuit complГЁte de sommeil au dГ©but de l’utilisation. Il a Г©tГ© approuvГ© par la FDA en 1998 comme traitement des troubles du sommeil liГ©s au travail postГ© et de l’apnГ©e obstructive du sommeil. Aussi connu sous le nom de d-mГ©thamphГ©tamine ou mГ©thylphГ©nidate, le modafinil est un dГ©rivГ© de la phГ©nylГ©thylamine (analogue de l’amphГ©tamine) qui agit comme un stimulant du systГЁme nerveux central. Le modafinil Г©tait un composant d’un cocktail de trois mГ©dicaments qui a Г©tГ© approuvГ© comme traitement induisant le sommeil pour l’apnГ©e obstructive du sommeil. Il Г©tait auparavant connu sous des noms tels que Armodafinil, Reastin et Stimulant C. Il s’agit d’une sous-classe de rГ©cepteurs de l’adГ©nosine, qui ont Г©tГ© identifiГ©s dans le systГЁme nerveux central et la rГ©tine.
At this time it seems like BlogEngine is the best blogging platform available right now.
(from what I’ve read) Is that what you’re using on your blog? https://gratisafhalen.be/author/shanonriddo/
Feel the adrenaline of playing at 4rabet with quick login through 4rabet login . Whether you enjoy 4 ra bet sports betting or casino games , this site provides everything under one roof. Download the 4rabet app login for fast and easy access to your most loved options. Check out the 4rabet official website now and experience the thrill of 4rabet . Register now and elevate your casino fun to the ultimate thrill!
Discover the adrenaline rush of the 4rabet platform , your go-to destination for sports betting and thrilling bets in India. Whether you love basketball or different events , the 4rabet official website features a easy-to-use interface to place your bets and win big . With the mobile access to 4rabet , you can access your account at any moment, from anywhere , guaranteeing you stay in the game. The 4rabet betting site is created to serve both new players and high rollers, offering a diverse selection of betting options and slot machines .
Become a part of the growing 4rabet family today and experience a safe , intuitive gaming environment . Whether you enjoy the 4rabet login on your desktop or tablet, the 4rabet betting journey is top-tier. Kick off your betting experience with 4 ra bet and upgrade your casino fun to another level !
Link: https://1qfloors.com/kazino-1win-igrat-onlajn-besplatno2c-ofitsialnyj-sajt2c-skachat-klien/
4rabet India provides a seamless experience for online gambling and casino fans in India. With the secure sign-in process being hassle-free and secure , users can log into their accounts without issues. The smartphone access ensures ease for those on the go , enabling them to play with ease. The 4rabet website provides a vast selection of wagering opportunities , including cricket , and other major sports, designed for Indian bettors . The website is beginner-friendly, simplifying the experience for both first-time players and experienced players to navigate . By accessing the 4rabet official website , members can take advantage of exclusive bonuses . The 4ra bet platform is famous for its trusted service and fast payouts , providing a satisfying online gambling journey. Whether you love gambling on matches or casino games , 4rabet has something for everyone .
Mexican Pharm International: Mexican Pharm Inter – mexican pharmacy online store
MexicanPharmInter mexican pharmacy online order Mexican Pharm International
Experience the excitement of 4rabet online gaming with seamless access through your 4rabet account . Whether you enjoy sports wagering on 4rabet or online gambling , 4rabet brings it all under one roof. Install the 4rabet app login for instant and easy access to your favorite games . Explore the 4rabet official website today and dive into the world of 4ra bet excitement . Register now and elevate your betting journey to the ultimate thrill!
Discover the adrenaline rush of 4rabet , your best platform for sports betting and casino games in India. Whether you’re a fan of football or different events , the 4rabet official website features a seamless system to enjoy betting and earn rewards . With the 4rabet app login , you can access your betting profile anytime , wherever you are, making sure you stay in the game. The 4rabet casino is created to serve both new players and high rollers, offering a vast collection of wagering opportunities and live dealer experiences.
Become a part of the 4rabet online community right away and experience a reliable, user-friendly betting system. Whether you like using 4rabet on your desktop or tablet, the 4rbet experience is top-tier. Start your journey with 4rabet India and take your gaming experience to another level !
Link: http://shadowpuppeteer.com/tag/game-concept/
4rabet India provides a seamless process for online gambling and casino fans in India. With the secure sign-in process being quick and secure , members can access their accounts in seconds . The mobile login feature ensures accessibility for mobile users , making it easy to bet anytime, anywhere . The 4rabet website provides a vast selection of sports events, including football , and more , catering to Indian audiences. The website is beginner-friendly, making it easy for both new users and experienced players to navigate . By checking out the official gaming page, users can enjoy special promotions. The 4rabet casino is known for its trusted service and fast payouts , ensuring a secure betting adventure . Whether you love gambling on matches or playing slots , our platform has the perfect choice for you.
darknet websites https://github.com/aresonioncq0a7/aresonion – dark web sites
canada cloud pharmacy: highest rated canadian online pharmacy – canadian pharmacy com