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
10 Meetups On Four Wheel Mobility Scooters You Should Attend 4 wheel all terrain Electric scooter
5 Killer Qora’s Answers To Personal Injury Claim Personal injury law firms
Рекламное агентство – это компания, которая занимается созданием
и реализацией рекламных кампаний для различных клиентов.
Рекламное агентство может предлагать следующие услуги:
1. Разработка рекламной стратегии:
анализ аудиитории, определение целей и задач рекламной
кампании, выбор каналов рекламы и бюджетирование.
2. Создание рекламного контента:
разработка рекламных материалов, таких как видеоролики,
баннеры, печатные объявления, тексты для социальных сетей и
т.д.
3. Медиапланирование: выбор оптимальных каналов для
размещения рекламы, закупка рекламного пространства, мониторинг эффективности кампании.
4. Социальные сети: создание и управление рекламными
кампаниями в социальных сетях, таких
как Facebook, Instagram, Twitter и т.д.
5. Оцифровка: преобразование традиционных рекламных форматов в цифровые, такие как email-рассылка, мобильная реклама и т.д.
6. Анализ и отчетность: отслеживание эффективности рекламной кампании, анализ результатов,
предоставление отчетов клиенту.
Рекламные агентства могут специализироваться на
различных областях, таких как:
1. Digital-агентство:?ализируется на цифровой
рекламе, включая поиск, социальные сети, email-рассылку и т.д.
2. Full-service-агентство: предлагает
полный спектр услуг, включая разработку рекламной стратегии, создание контента и медиапланирование.
3. Брендинговое агентство: специализируется на разработке бренда, включая создание логотипа,
упаковки и т.д.
4. Event-агентство: организует и продвигает
мероприятия, такие как конференции,
семинары, выставки и т.д.
5. PR-агентство: занимается по связям с общественностью, включая
общение с СМИ, кризис-менеджмент и т.д.
Также рекламные агентства могут иметь различные бизнес-модели, такие как:
1. Фиксированная плата: агентство получает фиксированную плату за свои услуги.
2. Комиссионная плата: агентство получает комиссию от рекламного бюджета клиента.
3. Результативная плата: агентство
получает плату только в случае достижения определенных результатов, таких как
увеличениеconversion rate или дохода.
В целом, рекламное агентство играет важную роль в развитии бизнеса, помогая компаниям
привлекать внимание целевой аудитории и достигать своих
маркетинговых целей.
мы предаставляем услуги такие как
мастер продвижения сайтов
мы работаем 24 на 7 обращайтесь поможем по разным вопроса по маркетингу
123
You’ll Never Guess This Dangerous Drugs Lawsuits’s Benefits dangerous Drugs Lawsuits
A person neсessarily lend a hɑnd to maке critically aryicles I
ᴡould ѕtate. Тhіs is the very fіrst tіme I frequenteed your web pаցe and up to now?
I amazed with the research you made to mɑke tһіs actual publish
extraordinary. Excellent process!
Ηere is myy web-site: slot yang lagi gacor sekarang
where to get cheap periactin no prescription
You’ll Be Unable To Guess Window Repair Near Me’s Tricks window repair near Me (https://www.whyiwu.Com)
Link exchange is nothing else however it is only placing the other person’s webpage link on your page at proper place and
other person will also do similar in favor of you.
The 12 Worst Types Of The Twitter Accounts That You Follow windowreplacement
5 Reasons To Consider Being An Online ADD In Adults Treatment
Shop And 5 Reasons You Shouldn’t symptoms of untreated adhd in Adults – m.danielwood.Co.kr,
Antihistamine medications for rhinitis
http://generik-dapoxetin.ru/
What’s The Current Job Market For Slot Bonuses Professionals?
slot bonuses (https://u2l.Io/videoslots599737)
The 12 Most Popular Best Slot Payouts Accounts To Follow On Twitter Best slot machines
get albuterol price
Why Workers Compensation Litigation Isn’t A Topic That People Are Interested In. Workers’ Compensation Law Firm
Stop by my web site: where can i find sex near me
At this time I am going to do my breakfast, after having my breakfast coming over again to read other news.
Paragraph writing is also a fun, if you know afterward you can write or
else it is difficult to write.
My homepage :: best way to take fitspresso
My partner and I stumbled over here by a different web address and thought I should check
things out. I like what I see so now i am following you.
Look forward to looking into your web page repeatedly.
Genuinely no matter if someone doesn’t understand after that its up to other visitors
that they will assist, so here it takes
place.
Hello! I could have sworn I’ve been to this site before but after reading through some of the post I realized it’s new to me.
Anyways, I’m definitely glad I found it and I’ll be book-marking and checking back
often!
my website … facebook hookup near me – galvestonhousesforsale.com –
15 Strange Hobbies That Will Make You More Successful At Slot Innovations casino Slot machines
Hi there, I discovered your site by the use of Google even as looking for a comparable topic,
your web site came up, it seems great. I have bookmarked it in my google bookmarks.
Hello there, just become alert to your blog thru Google, and
found that it’s really informative. I’m going to watch out for brussels.
I’ll be grateful for those who proceed this in future.
Numerous people will probably be benefited from your writing.
Cheers!
The Most Significant Issue With Mesothelioma Compensation, And How You Can Fix It Mesothelioma lawsuits
조루증을 치료하기 위한 행동요법 5단계
조루증을 치료하기 위한 행동요법 5단계
Guide To Double Glazing Near Me: The Intermediate Guide For Double Glazing Near Me double glazing near me
Olivier Jonathan Giroud https://olivier-giroud.prostoprosport-fr.com French footballer, striker for Milan and the French national team. Knight of the Legion of Honor. Participant in four European Championships (2012, 2016, 2020 and 2024) and three World Championships (2014, 2018 and 2022).
5 Killer Quora Answers On Shopping Online Uk Clothes Shopping Online Uk Clothes