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
%%
my web-site; http://skustore.ru/blog/russian-stores/1831.html
I’ve ⅼearn a feww good stuff here. Certainly vaⅼue bookmarking for revisiting.
I surprise how a lot effort yоu set to maҝe this type of
magnifiϲent informative websitе.
Also visit my blog post :: gacor (http://www.pdc.edu)
stromectol south africa: stromectol online – ivermectin 5ml
Great beat ! I wish to apprentice while you amend your site,
how can i subscribe for a blog web site? The account aided me a acceptable deal.
I had been a little bit acquainted of this your broadcast provided bright clear concept
my webpage: house clearance south east london
http://buyprednisone.store/# prednisone ordering online
amoxicillin 1000 mg capsule amoxicillin 500mg capsule buy online medicine amoxicillin 500mg
http://buyprednisone.store/# buy prednisone online without a script
buy amoxicillin without prescription: amoxicillin 500 mg without prescription – buy amoxicillin online without prescription
Excellent way of telling, and nice paragraph to obtain facts on the topic of my presentation topic, which i am going to deliver in university.
Your Full Manual to Gutter Installation, Gutter Protector Setting up, and Rain Gutter Cleaning Services
If you’re a homeowner, one grasp the significance of maintaining a efficient gutter setup. Gutters serve an important role in shielding your home from rainwater damage by channeling water from rainfall away from the roof and foundation. However, making sure your rain gutters are in top condition requires more than just occasional cleansing. From rain gutter installation to rain gutter guard installation and rain gutter cleaning services, this comprehensive manual addresses everything you need to be aware of to keep your gutters in optimal shape.
Rain Gutter Setting up
Why Rain Gutters Are Important
Before we dive into gutter setting up, let’s understand why rain gutters are vital for your home. Gutters help prevent water damage by directing water from rainfall away from your house’s foundation, walls, and landscaping. Without adequate water drainage, rainwater runoff can cause wear and tear, basement flooding, mold growth, and constructional harm.
Signs You Need New Rain Gutters
Cracks or Rust: Visible cracks or rust spots suggest that your gutters are deteriorating and may need to be replaced.
Sagging or Pulling Away: Rain gutters that sag or pull away from the house are not effectively directing water away and ought to be replaced.
Water Damage: Water stains on the exterior of your house or basement flooding may indicate that your gutters are not functioning properly to do their job.
Frequent Clogs: If your rain gutters are constantly clogged with debris, it might be time to invest in an updated gutter system that is easier to upkeep.
Rain Gutter Materials
When it comes to rain gutter materials, one have numerous options to select from:
Aluminum: Lightweight, rust-resistant, and available in a variety of colors.
Vinyl: Affordable, easy to set up, and low maintenance.
Steel: Durable and appropriate for regions with harsh weather conditions.
Copper: Elegant, long-lasting, and adds a decorative touch to your home.
DIY vs. Professional Setting up
While some house owners might try to set up gutters themselves, it’s often best to leave this job to the professionals. Professional gutter installers have the experience, tools, and expertise to ensure that your gutters are installed correctly and function optimally. Plus, hiring a professional can save you time and hassle in the long run.
Gutter Guard Setting up
The Importance of Gutter Guards
Rain Gutter guards are an essential addition to any gutter system. These protective covers avert leaves, twigs, and debris from clogging your rain gutters, minimizing the need for regular cleaning and reducing the risk of water damage to your home.
Types of Rain Gutter Guards
Mesh Screens: Fine mesh screens permit water to flow through while blocking debris.
Reverse Curve: These gutter guards feature a curved surface that directs water into the gutter while stopping leaves and debris from entering.
Brush Inserts: Brush-style inserts fit inside the rain gutter and prevent leaves from accumulating while allowing water to flow freely.
Foam Inserts: Foam rain gutter guards block debris while allowing water to filter through.
Professional Installation vs. DIY
While some homeowners might try to install rain gutter guards themselves, professional setting up is often recommended. Professional installers can ensure that gutter guards are properly fitted and securely attached, minimizing the risk of debris buildup and water damage.
Gutter Cleaning Assistance
The Importance of Gutter Cleaning
Regular gutter cleaning is essential for upkeeping a functional rain gutter system. Over time, leaves, twigs, and debris can accumulate in your rain gutters, leading to clogs and water overflow. Professional gutter cleaning services can help stop these issues and extend the life of your rain gutters.
Signs You Require Gutter Cleaning
Visible Debris: If you observe leaves, twigs, or other debris in your rain gutters, it’s time for an cleansing.
Water Overflow: Overflowing rain gutters during rainstorms suggest that they are clogged and require to be cleaned.
Sagging Rain Gutters: Rain gutters that sag or pull away from the home might be weighed down by debris and require cleaning.
Gutter installation
Frequency of Gutter Cleaning
The frequency of rain gutter cleaning depends on several factors, including the surrounding vegetation, climate, and gutter guard installation. In general, it’s recommended to clean your rain gutters at least twice a year, ideally in the spring and fall, to remove seasonal debris buildup.
Conclusion
Maintaining a functional rain gutter system is essential for shielding your house from water damage and preserving its structural integrity. Whether you require rain gutter installation, gutter guard installation, or rain gutter cleaning assistance, investing in professional assistance can save you time, money, and hassle in the long run. By prioritizing maintenance, you can ensure that your home remains safe, dry, and protected for years to come.
generic lasix Buy Lasix No Prescription lasix online
I enjoy what you guys tend to be up too. Such clever work and exposure!
Keep up the great works guys I’ve incorporated you guys to
our blogroll.
prednisone 100 mg: 5mg prednisone – buying prednisone on line
https://stromectol.fun/# how much is ivermectin
Everything is very open with a clear explanation of the challenges.
It was really informative. Your website is very helpful.
Thanks for sharing!
prednisone 250 mg: buy prednisone online australia – prednisone online for sale
lisinopril 3.125: lisinopril 200 mg – lisinopril in usa
https://bbs.heyshell.com/forum.php?mod=viewthread&tid=22052
This is my first time pay a quick visit at here and i am
truly happy to read all at alone place.
Take a look at my blog: http://new.mielecki.mielec.pl
prednisone tablets 2.5 mg buy prednisone no prescription buy prednisone 20mg
https://pravgruzchiki.ru/
generic prednisone tablets prednisone 0.5 mg 2.5 mg prednisone daily
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 suggestions would be greatly appreciated.
prednisone 10mg online: prednisone 5093 – prednisone acetate
can i buy amoxicillin over the counter amoxicillin pharmacy price can i purchase amoxicillin online
http://stromectol.fun/# ivermectin 50
Bet on all your favorite sports at 1xBet
Win Big with 1xBet: The Top Sports Betting Platform
Experience the Excitement of Online Betting with 1xBet
Get in on the Action with 1xBet: The Best Sports Betting Site
Unleash Your Winning Potential with 1xBet
Bet and Win with Confidence at 1xBet
Join the 1xBet Community and Start Winning Today
The Ultimate Sports Betting Experience Awaits at 1xBet
1xBet: Where Champions Are Made
Take Your Betting to the Next Level with 1xBet
Get Ready to Win Big at 1xBet
Multiply Your Winnings with 1xBet’s Exciting Betting Options
Elevate Your Sports Betting Game with 1xBet
Sign Up for 1xBet and Start Winning Instantly
Experience the Thrill of Betting with 1xBet
1xBet: Your Ticket to Winning Big on Sports
Don’t Miss Out on the Action at 1xBet
Join 1xBet Today and Bet on Your Favorite Sports
Winning Has Never Been Easier with 1xBet
Get Started with 1xBet and Discover a World of Betting Opportunities
1xbet program 1xbet com app .
http://buyprednisone.store/# prednisone brand name us
We absolutely love your blog and find the majority of your
post’s to be exactly what I’m looking for. Would you offer
guest writers to write content for yourself? I wouldn’t mind
writing a post or elaborating on a few of the subjects you write in relation to here.
Again, awesome website!
price of lisinopril 20 mg: lisinopril 2.5 mg – lisinopril 12.5 20 g