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
Привет! Недавно искали рекомендации по элитным сервисам в своём городе и неожиданно обнаружила на один Telegram-канал. Откровенно говоря, удивилась, насколько всё грамотно устроено: премиальные предложения, индивидуальный подход, абсолютная конфиденциальность. Если вас привлекает подобное, напишите мне в личные сообщения, с радостью подскажу.
эпоксидные бетонные полы
Medicines prescribing information. Generic Name.
loperamide price
Actual about drug. Get information now.
Профессиональный сервисный центр по ремонту МФУ в Москве.
Мы предлагаем: сервис мфу в москве
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
indian pharmacy online: indianpharmacy com – buy prescription drugs from india
canadian pharmacy reviews certified canadian international pharmacy canadianpharmacyworld com
buying prescription drugs in mexico online: reputable mexican pharmacies online – medicine in mexico pharmacies
Fastidious answer back in return of this matter with solid arguments and explaining everything on the topic of that.
pharmacies in mexico that ship to usa: mexican pharmacy – best online pharmacies in mexico
mexico pharmacies prescription drugs
Здравствуйте! Совсем недавно искали рекомендации касательно премиум-сервисам у нас в городе и случайно обнаружила на интересный Telegram-канал. Честно говоря, меня удивило, насколько всё качественно сделано: высококлассные услуги, индивидуальный подход, абсолютная конфиденциальность. Если вас привлекает подобное, обращайтесь в личку, с радостью подскажу.
полиуретановый пол ral
canadian drug pharmacy: Cheapest online pharmacy – best canadian pharmacy to buy from
Overview
In a world that transforms at lightning speed, the skill to create isn’t just advantageous—it’s vital. Whether you’re an business owner, a corporate leader, or a programmer, staying ahead requires an original mindset. This blog post will examine the idea of innovation, uncovering what it takes to be a real innovator and why it’s more important now than ever. You’ll learn traits that distinguish successful innovators, uncover encouraging case studies, and gain practical strategies for fostering your own creative thinking.
What is Innovation and Why Does it Matter?
Innovation is more than just a catchphrase; it’s the core of progress. It requires creating new ideas or improving existing ones, leading to measurable benefits. In today’s fast-paced environment, businesses must innovate to thrive and grow. Innovation fuels productivity, enhances customer interaction, and opens new income streams. Without it, stagnation is unavoidable.
Traits of a True Innovator
Creativity
https://open.spotify.com/user/315dinldrfeteavaw5odm2f4cq6i
At the core of innovation is creativity. This quality allows individuals to think outside the box, generating distinct solutions to complicated problems. Creative thinking can be cultivated by introducing oneself to diverse perspectives and viewpoints.
Adaptability
In a quickly changing world, an innovator must be adaptable. Being able to adjust when faced with new challenges or opportunities is crucial. Adaptability assures that you can develop alongside market shifts and tech advancements.
Risk-Taking
Innovation often entails venturing into the unexplored. True innovators are willing to take calculated risks. They understand that failure is a part of the process and use it as a educational tool to refine their ideas.
Case Studies of Successful Innovators
Elon Musk
Elon Musk’s innovative ventures, from Tesla to SpaceX, have revolutionized industries. His preparedness to tackle huge technological challenges and alter established markets showcases the strength of a bold vision.
Sara Blakely
Sara Blakely, the founder of Spanx, turned a basic idea into a billion-dollar conglomerate. Her innovation in the apparel industry demonstrates how solving everyday problems can lead to exceptional success.
Steve Jobs
Steve Jobs’ relentless pursuit of innovation transformed Apple into a worldwide tech giant. His focus on appearance and user satisfaction set new benchmarks for the industry, proving that innovation can be a key differentiator.
Fostering an Innovative Mindset
Encourage a Culture of Openness
Creating an environment where new ideas are embraced and valued is paramount. Organizations should promote employees to share their ideas without fear of judgment. This openness fosters cooperation and sparks creativity.
Learn from Failure
Failure is an inevitable part of the innovation journey. Instead of avoiding it, innovators should view failure as an opportunity to learn and grow. Reviewing what went wrong and why can provide valuable insights for future projects.
Embrace New Technologies
Tech advancements offer endless possibilities for innovation. Staying informed with the latest advancements and tools can provide a competitive edge. Whether it’s AI, blockchain, or IoT, leveraging new technologies can lead to significant breakthroughs.
The Role of Innovation in Business Growth
Driving Efficiency
Innovative methods can streamline operations, reducing costs and boosting efficiency. Automation and digital evolution are illustrations of how businesses can innovate to enhance productivity.
Enhancing Customer Experience
Innovation can significantly improve customer experience. By understanding customer needs and developing personalized solutions, businesses can foster loyalty and promote growth. Personalized services and innovative products can set a company apart from its peers.
Opening New Revenue Streams
Innovative thinking can uncover new commercial opportunities. Diversifying product lines, entering new sectors, or developing unique services can open new revenue streams. This variety mitigates risk and promotes sustainable growth.
Conclusion
Innovation is the driving force behind success in today’s fluid world. By understanding the qualities of true innovators, learning from effective case studies, and fostering an innovative mindset, you can unlock your original potential. Remember, innovation isn’t just about revolutionary inventions; it’s about making ongoing improvements that add value. Whether you’re leading a team or pursuing individual projects, the ability to innovate will set you apart and drive your success. Now, it’s time to put these insights into action and start your own innovative journey.
10 Startups That Will Change The Cheap Realistic
Sex Doll Industry For The Better cheap realistic Sex dolls
mexico drug stores pharmacies: mexican pharmacy – buying prescription drugs in mexico online
medication from mexico pharmacy
Профессиональный сервисный центр по ремонту планшетов в том числе Apple iPad.
Мы предлагаем: мастер по ремонту айпадов
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Hi, I do think this is an excellent web site. I stumbledupon it 😉 I am going to come back yet again since I saved as a
favorite it. Money and freedom is the best way to change, may you be rich and continue to help others.
чтобы зайти в аккаунт, https://favoriweb.com/ требуется:
предпочесть имеющийся
логин с пароль.
mexican online pharmacies prescription drugs: medication from mexico – п»їbest mexican online pharmacies
mexican online pharmacies prescription drugs
india pharmacy: online Indian pharmacy – online pharmacy india
best online pharmacies in mexico: mexican pharma – mexico drug stores pharmacies
mexican drugstore online
mexico drug stores pharmacies: mexico drug stores pharmacies – buying prescription drugs in mexico online
mexico drug stores pharmacies: mexican border pharmacies shipping to usa – purple pharmacy mexico price list
15 Of The Best Documentaries On Integrated French Style Fridge Freezer Integrated french door fridge freezer
See What Treadmill Used For Sale Tricks The Celebs Are
Using treadmill used for sale [Casie]
Your style is really unique compared to other folks I have read stuff from.
Thanks for posting when you have the opportunity,
Guess I’ll just bookmark this site.
Overview
In a realm that evolves at rapid speed, the skill to develop isn’t just helpful—it’s vital. Whether you’re an founder, a business leader, or a programmer, staying at the forefront requires an creative mindset. This blog post will examine the idea of innovation, uncovering what it takes to be a true innovator and why it’s more critical now than ever. You’ll learn traits that characterize successful innovators, discover motivating case studies, and gain usable strategies for fostering your own original thinking.
What is Innovation and Why Does it Matter?
Innovation is more than just a catchphrase; it’s the lifeblood of progress. It requires creating new ideas or improving existing ones, leading to concrete benefits. In today’s quick environment, businesses must innovate to exist and grow. Innovation propels productivity, enhances customer interaction, and opens new income streams. Without it, standstill is inevitable.
Traits of a True Innovator
Creativity
https://open.spotify.com/user/315dinldrfeteavaw5odm2f4cq6i
At the center of innovation is creativity. This quality allows individuals to think beyond the box, generating original solutions to difficult problems. Innovative thinking can be fostered by exposing oneself to diverse perspectives and experiences.
Adaptability
In a rapidly changing world, an innovator must be versatile. Being able to adjust when faced with new obstacles or opportunities is critical. Adaptability ensures that you can develop alongside market changes and technological advancements.
Risk-Taking
Innovation often involves venturing into the unexplored. True innovators are willing to take thought-out risks. They know that failure is a part of the process and use it as a growth tool to improve their ideas.
Case Studies of Successful Innovators
Elon Musk
Elon Musk’s innovative ventures, from Tesla to SpaceX, have changed industries. His willingness to tackle enormous technological challenges and shake up established markets showcases the power of a bold vision.
Sara Blakely
Sara Blakely, the creator of Spanx, turned a basic idea into a billion-dollar empire. Her innovation in the clothing industry demonstrates how solving everyday problems can lead to exceptional success.
Steve Jobs
Steve Jobs’ persistent pursuit of innovation transformed Apple into a international tech giant. His focus on design and user interaction set new criteria for the industry, proving that innovation can be a key advantage.
Fostering an Innovative Mindset
Encourage a Culture of Openness
Creating an atmosphere where new ideas are accepted and valued is crucial. Organizations should support employees to share their ideas without fear of judgment. This openness fosters cooperation and sparks creativity.
Learn from Failure
Failure is an unavoidable part of the innovation journey. Instead of avoiding it, innovators should view failure as an opportunity to learn and grow. Reviewing what went wrong and why can provide valuable insights for future efforts.
Embrace New Technologies
Digital advancements offer endless potential for innovation. Staying current with the latest developments and tools can provide a competitive edge. Whether it’s AI, blockchain, or IoT, leveraging new technologies can drive significant breakthroughs.
The Role of Innovation in Business Growth
Driving Efficiency
Innovative methods can streamline operations, reducing costs and boosting efficiency. Automation and digital change are illustrations of how businesses can innovate to enhance productivity.
Enhancing Customer Experience
Innovation can significantly improve customer satisfaction. By understanding customer requirements and developing tailored solutions, businesses can foster loyalty and drive growth. Tailored services and innovative products can set a company apart from its peers.
Opening New Revenue Streams
Innovative thinking can uncover new commercial opportunities. Diversifying product lines, entering new sectors, or developing unique services can open new revenue streams. This diversification mitigates risk and promotes sustainable growth.
Conclusion
Innovation is the driving force behind achievement in today’s fluid world. By understanding the traits of true innovators, learning from successful case studies, and fostering an innovative mindset, you can unlock your original potential. Remember, innovation isn’t just about revolutionary inventions; it’s about making constant improvements that add value. Whether you’re leading a team or pursuing personal projects, the ability to innovate will set you apart and drive your success. Now, it’s time to put these insights into action and start your own original journey.
canadian world pharmacy: Cheapest online pharmacy – pharmacy canadian superstore
http://indiadrugs.pro/# best india pharmacy
Keep on working, great job!
northern pharmacy canada: Canadian Pharmacy – canadapharmacyonline legit
https://indiadrugs.pro/# online pharmacy india