<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ali Osman Menekse on Medium]]></title>
        <description><![CDATA[Stories by Ali Osman Menekse on Medium]]></description>
        <link>https://medium.com/@alimenekse?source=rss-1f19a6d18af2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oRey8ZH_XEhAomNLhBoT5w@2x.jpeg</url>
            <title>Stories by Ali Osman Menekse on Medium</title>
            <link>https://medium.com/@alimenekse?source=rss-1f19a6d18af2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 19:17:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alimenekse/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unlocking the Power of JavaScript: Reduce Your NPM Package Size by 99%]]></title>
            <link>https://medium.com/insiderengineering/javascript-performance-optimization-with-vite-rollupjs-587d2cbf1979?source=rss-1f19a6d18af2------2</link>
            <guid isPermaLink="false">https://medium.com/p/587d2cbf1979</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[vites]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[lighthouse]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ali Osman Menekse]]></dc:creator>
            <pubDate>Mon, 25 Sep 2023 07:02:30 GMT</pubDate>
            <atom:updated>2023-09-25T07:02:30.035Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9Dbq91XRIPzNXK7AH1IgQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@austin__ramsey">Austin Ramsey</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p>Let me continue to kick off my writings with beloved book quotes.</p><blockquote>Planning is important, but the most important part of every plan is to plan on the plan not going according to plan<br>- Morgan Housel</blockquote><p>In this article, I will discuss how we improved Lighthouse metrics from 38% to 82% and reduced FCP (First Contentful Paint) time from 5.7 seconds to around 1.0~1.7 seconds in projects where we use the Design System package.</p><figure><img alt="Lighthouse Metrics" src="https://cdn-images-1.medium.com/max/1024/1*bVIrH6s8itv_-WVmb_KuVA.png" /><figcaption>Lighthouse Metrics</figcaption></figure><p>Let me begin by explaining how we got here. We as Insider development team have developed 11 different products for our company, and to better manage the front-end part of these products, we utilized the Design System. You can find the relevant article <a href="https://medium.com/insiderengineering/how-to-design-a-design-system-part-i-38a5c87f84f8">here</a>.</p><p>Since the Design System contained all components, a 13.6 MB JavaScript file was built. As you can imagine, downloading a 13.6 MB package for the initial load, even if you’re using a single-page application, gives a negative impression of your performance and doesn’t make the user happy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUqeQkIo-Yj998TrLPCKow.png" /><figcaption>13 MB design system file that has been built</figcaption></figure><h4>So, what did we do?</h4><p>We started by separating the products from each other, and now each of them continues to exist in separate repositories. This helped us reduce FCP from 5.7 seconds to 3.4 seconds. However, the topic of how we separated the products is for another article.</p><p>We have a VueJS NPM package which we build with Webpack. Initially, we switched from Webpack to Vite, which reduced the package size from 13.6 MB to 6 MB. But that wasn’t enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6vgJ8dhyPZMoFzhYAb_xgA.png" /><figcaption>6 MB (gzip:1.3 MB) design system file that has been built</figcaption></figure><h4>So, what was different about Vite?</h4><ol><li><strong>Fast Development Server:</strong> Vite can start the development server quickly, allowing you to see changes instantly. This significantly speeds up the development process and provides real-time feedback.</li><li><strong>Modular Development: </strong>Vite has a modular structure, giving each component and module its own scope. This allows you to work on independent modules.</li><li><strong>Dynamic Import Support: </strong>Vite supports dynamic imports, which allows it to better analyze dependencies and only compile the modules that are used.</li><li><strong>ESModule Usage:</strong> Vite uses the ESModule standard, enabling the use of modern JavaScript modules, which are more efficient than older module systems like CommonJS.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dXdJl_xcujRjn4emltkv1A.png" /><figcaption>Webpack Bundle Mechanism</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*axcRydnM9cPDINK8BeLrNQ.png" /><figcaption>Vite Bundle Mechanism</figcaption></figure><h4>6 MB (gzip:1.3 MB) with Vite seemed sufficient, right?</h4><p>When we built the Design System, it was producing a single JavaScript file and assets. This meant that on each refresh, we had to load 1.3 MB. As you can see in the code below, in index.js, we were exporting all components, resulting in a single large built JS file. Yes, we had reduced it to 1.3 MB with Vite, but it needed to be further reduced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0otewbQaIt13KBEKGFsk8Q.png" /><figcaption>Exported Design System Components</figcaption></figure><p>This is where we decided that using RollupJS to go for a component-based build system would be more logical. Each component could now be exported individually, and during the build, each component would only be built for itself. This way, we wouldn’t have to load unnecessary components for the page the user entered. This allowed us to download smaller pieces without being affected by bandwidth throttling, providing faster returns for other necessary requests, and ensuring that our page opened earlier.</p><h4>But how?</h4><p>We configured each component individually, resulting in a unique JS build for each one. This approach enables us to use each component separately as needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4238iIeA-FZa_QUZyXtdDQ.png" /><figcaption>vite.config.js (Function can be written for this part)</figcaption></figure><p>As a result, we successfully reduced the package size to as low as 4 KB, depending on the components used, with an average component size of 35 KB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4sRFbSA2YqQ1ZeE1I9s4yw.png" /><figcaption>The size of the built design system components</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WNE3Cu7qUOztNLkYwsgHAw.png" /><figcaption>Lighthouse Metrics</figcaption></figure><p>In summary, in this article, we discussed ways to improve Lighthouse metrics and FCP time significantly in projects using the Design System package. First, we understood how a 13.6 MB JavaScript file negatively affected the user experience and took various steps to address this issue.</p><p>First, we organized the projects into separate repositories, reducing FCP <strong>from 5.7 seconds to 3.4 seconds</strong>. Then, we switched from Webpack to Vite, which reduced the package size <strong>from 13.6 MB to 6 MB</strong>. By using RollupJS to export each component individually, we were able to reduce the package size even further, resulting in a download size as low as <strong>4KB</strong>, allowing users to download only the necessary components which has enabled users to experience FCP times <strong>as fast as 1~ second.</strong></p><p>However, the journey to improving performance is not over. There are more steps we can take to make our web applications faster and more efficient. I’ll discuss these topics in my upcoming articles. Until then, stay tuned!</p><ul><li>Fallbacks for font loading</li><li>Minification</li><li>Compression</li><li>Image optimization</li><li>Code splitting</li><li>Metric tracking</li><li>CDN usage</li><li>Lazy loading</li><li>Browser caching.</li></ul><p>If you are interested in topics related to front-end architecture, be sure to check out this <a href="https://medium.com/insiderengineering/front-end-architecture-part-%E2%85%B0-d5d1c6f87f12">article</a>. Don’t forget to follow the Insider Engineering Blog for more insightful <a href="https://medium.com/insiderengineering">articles! ✍️</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=587d2cbf1979" width="1" height="1" alt=""><hr><p><a href="https://medium.com/insiderengineering/javascript-performance-optimization-with-vite-rollupjs-587d2cbf1979">Unlocking the Power of JavaScript: Reduce Your NPM Package Size by 99%</a> was originally published in <a href="https://medium.com/insiderengineering">Insider One Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Front-End Architecture Part Ⅰ]]></title>
            <link>https://medium.com/insiderengineering/front-end-architecture-part-%E2%85%B0-d5d1c6f87f12?source=rss-1f19a6d18af2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d1c6f87f12</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Ali Osman Menekse]]></dc:creator>
            <pubDate>Mon, 23 May 2022 07:03:17 GMT</pubDate>
            <atom:updated>2022-05-23T07:03:17.096Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I will be writing about topics such as how we should set up an architecture for a large-scale front-end application, how we can benefit from design patterns, how components should be, and how we do error management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XdZ0YwKsgvRGpGWk.png" /></figure><p>As you might know that 5–10 years ago, all business logic was kept in the backend, and the front-end was only responsible for rendering the data. With the introduction of SPA into our lives, the responsibility of business logic began to shift to the front-end.</p><p>One of the most important reasons why we use SPA is the component base structure, so how should a component be like?</p><h4><strong>Component</strong></h4><p>The first rule of a component is that it should be small and short. The second rule is that they should be even shorter.</p><p>We should also consider the SOLID principles, which every software developer should know, when designing components but how?</p><ul><li>A component should have one and only one reason to change, meaning that a component should have only one job.</li><li>Components should be open for extension but closed for modification.</li><li>A change that you have made on a component should not affect another component</li><li>Dependency between components should be as low as possible.</li></ul><p>We can create a component by applying these principles, but managing them is so hard when product/team count increases, component count increases, etc. We use a Design System to prevent this.</p><h4>Design System</h4><p>When the team count increases in a software company, the company should have a design plan.</p><p>Why Design System?</p><ul><li>It provides consistency between pages.</li><li>It provides a way to develop a new UI Page quickly because developers use created components.</li><li>It is a common language between developers and designers.</li><li>It prevents rewriting the same component again and again.</li></ul><blockquote><em>We’re not designing pages, we’re designing systems of components.<br>- </em><a href="http://bradfrost.com/blog/mobile/bdconf-stephen-hay-presents-responsive-design-workflow/"><em>Stephen Hay</em></a></blockquote><p>We created a component with SOLID principles in the Design System but required to define an architecture for combining all of the components and creating a page. In this time we take advantage of the <a href="https://bradfrost.com/blog/post/atomic-web-design/">Atomic Design Methodology</a> shared by Brand Frost.</p><h4><strong>Atomic Design</strong></h4><p>Atomic Design provides the ability to create reusable components. The methodology’s name comes from the smallest unit into which matter can be divided. It targets to divide the smallest unit component.</p><p>It mentions 5 main structures. Atoms, Molecules, Organisms, Templates, Pages. I am not writing details for the atomic design.</p><p>Why?</p><ul><li>It increases the reusability of components</li><li>It prevents component/code repetition</li><li>It provides to increase development speed</li></ul><p>I mentioned how there should be UI for the front-end. But I need to decide on a business logic layer. Because every component depends on business logic. We need a strategy to manage business logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yfI8T4TS1eC2SpGZ.jpg" /></figure><h4><strong>Pure JavaScript Classes</strong></h4><p>I mentioned that components should be clean and don’t have as much business logic as possible. Because if components have business logic more than one and the same business logic needs different components, managing that would be so hard. In this situation, we can use the JS class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fuq0dAmdo4Wvd3XZ.png" /></figure><p>Why do we need it?</p><ul><li>We can use an object-oriented approach basically.</li><li>We can take advantage of the design pattern. The patterns solve problematic parts for the codebase If we use them at the correct time.</li><li>We can have independent business logic from Vue, React, Angular, etc. In this way, we can simply switch some of the technologies.</li><li>We can use the business logic class in different components because it does not depend on any component.</li></ul><p>We created components, design system, and architecture. Now we have the project. We can not ignore error cases so we need to accept that we may face bugs every time everywhere. Then we should handle all of the bugs.</p><p>If you want to find out more about the following subjects below, I will write them in my second blog post.</p><ul><li>Unit/Integration/Automation Test</li><li>Error Handling</li><li>Monitoring</li><li>GitHub Actions</li><li>Some of the Libraries</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d1c6f87f12" width="1" height="1" alt=""><hr><p><a href="https://medium.com/insiderengineering/front-end-architecture-part-%E2%85%B0-d5d1c6f87f12">Front-End Architecture Part Ⅰ</a> was originally published in <a href="https://medium.com/insiderengineering">Insider One Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Daha İyi Bir Front-End Seri-Ⅰ]]></title>
            <link>https://alimenekse.medium.com/daha-i%CC%87yi-bir-front-end-seri-%E2%85%B0-ed68e6fd3f2e?source=rss-1f19a6d18af2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed68e6fd3f2e</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Ali Osman Menekse]]></dc:creator>
            <pubDate>Sun, 13 Feb 2022 21:00:55 GMT</pubDate>
            <atom:updated>2022-02-14T21:53:52.907Z</atom:updated>
            <content:encoded><![CDATA[<p>Bu yazımda büyük ölçekli bir front-end applicationu için nasıl bir mimari kurmalıyız, tasarım kalıplarından nasıl faydalanabiliriz, componentler nasıl olmalı ve hata yönetimini nasıl yaparız gibi başlıklara değineceğim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4KMFF-N50NSgT5G_zfRAWA.png" /></figure><p>Biliyorsunuz ki bundan 5-10 yıl önce tüm business logic backendde tutulur front-end ise sadece datayı renderlamaktan sorumlu olurdu. SPA’nin hayatımıza girmesiyle beraber bussiness logic in sorumluluğu front-ende kaymaya başladı.</p><p>SPA kullanmamızdaki en önemli nedenlerden biri de component base yapısıdır peki bir component nasıl olmalı?</p><h4>Component</h4><p>Bir componentin ilk kuralı küçük, kısa olmaları gerektiğidir. İkinci kural ise daha da kısa olmaları gerektiğidir.</p><p>Her yazılımcının mutlaka bilmesi gereken SOLID prensiplerini component tasarlarken de göz önünde bulundurmalıyız.</p><ul><li>Bir component olabildiğince tek bir iş için çalışması</li><li>Componentin davranışını değiştirmiyor ve yeni özellikler kazanabiliyor olmalıdır.</li><li>Componentlerde yaptığımız değişiklik diğer componentleri etkilememesi gerekmektedir.</li><li>Componentler arasındaki bağımlılık olabildiğince az olmalıdır.</li></ul><p>Componentlerimizi ne kadar prensiplere göre oluştursak da component sayısısı ve bu componentleri kullanan ürün/takım sayısı arttıkça bunları yönetmek bir hayli zor oluyor. Bu karmaşayı ortadan kaldırmak için de Design System den faydalanıyoruz.</p><h4>Design System</h4><p>Bu büyüme, şirketlerin tasarım tarafında UI çalışmalarını daha düzenli yürütmeleri ve düzene koymaları ihtiyacını doğuruyor.</p><p>Neden design system?</p><ul><li>Sayfalar içinde kullanılan componentlerin tutarlı olmasını sağlar</li><li>Var olan componentlerden bir sayfa hazırlandığı için daha hızlı UI geliştirmesine olanak sağlar</li><li>Tasarımcı ile developer arasında ortak bir dil olur</li><li>Tekrarlayan componentlerin önüne geçilmesini sağlar</li></ul><blockquote><em>We’re not designing pages, we’re designing systems of components.<br>- </em><a href="http://bradfrost.com/blog/mobile/bdconf-stephen-hay-presents-responsive-design-workflow/"><em>Stephen Hay</em></a></blockquote><p>Componentlerimizi oluşturduk ve bu parçaları birleştirip bir sayfa yaratmak istiyoruz bunun için de bir mimari düzene ihtiyacımız var bu noktada Brand Frost un <a href="https://bradfrost.com/blog/post/atomic-web-design/">Atomic Design</a> methodolojisinden faydalanacağız.</p><p><strong>Atomic Design</strong> <br>Atomic design metodolojisi tam olarak tekrar kullanılabilir parçalar üretmek için tasarlanmış bir mimari modeldir. Bu mimari model ismini maddenin en küçük yapı taşı olan atomlardan alır. Componentleri de en küçük parçalarına kadar ayırmayı hedefler.</p><p>Bir web sayfasının 5 ana yapıdan oluşması gerektiğinden bahseder. Atomlar, moleküller, organizmalar, templateler ve pageslardan oluşmalıdır. Atomic designın detayına da girmeden neden kullanmalıyız ne faydaları var ondan bahsetmek istiyorum. Tabii ki her metodolojinin çözdüğü sorunlar olsa da aynı zamanda getirdiği bazı sorunlar da olabiliyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mk9NO1CaPRCj5drW8L1yYg.png" /></figure><p>Neden atomic design?</p><ul><li>Componentlerin tekrar kullanılabilirliğini artırır</li><li>Component ve code tekrarının önüne geçer</li><li>Daha hızlı development</li></ul><p>UI olarak projemizin nasıl bir mimaride olması gerektiğinden bahsettik tabii ki bu componentler bir bussiness logic ile birleştiğinde bir ürün ortaya çıkmış oluyor ve bu business logicleri de yönetmek için belirli stratejilere ihiyacımız var.</p><p><strong>Pure JavaScript Classları</strong></p><p>Componentleri olabildiğince sade ve business logicden uzat tutmamız gerektiğinden bahsetmiştik. Tabii ki bir component kendi içinde bu business logice sahip olabilir ama bir component birden fazla iş akışına sahip olduğunda ya da aynı iş akışı birden fazla component için de geçerli olduğunda componenti ve kodu yönetmek zor bir durum alıyor. Bu durumda JS classlarından faydalanmamız gerekiyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tyDwCndWALqkPlD2-F-OUQ.png" /></figure><p>Neden ihtiyacımız var?</p><ul><li>Object Oriented yaklaşımları JS Classlarında kolaylıkla uygulayabiliriz.</li><li>Yıllardır belirli sorunlara çözüm olarak geliştirilen tasarım kalıplarından faydalanabiliriz.</li><li>Vue, React, Angular gibi kütüphane ya da çatılara bağımsız bir iş akışına sahip olduğumuzdan teknolojiler arası geçişimizi kolaylaştırır.</li><li>Component business logicden bağımsız çalışacağı için aynı componenti farklı business logicler için de rahatlıkla kullanabilmemize olanak sağlayacaktır.</li></ul><p>Componentlerimizi oluşturduk, mimarimizi kurduk ve artık çalışan bir ürünümüz var. Tabii ki her kod gibi bizim kodumuzun da hatalı parçaları olması kaçınılamaz bir durum. Hatanın her zaman olabileceğini kabul edip bunlara en erken çözümleri getirebilmek için çözümler üretmeli ve bu hataların handle ediyor olmamız gerekir.</p><p>Serinin ikinci kısmında aşağıdaki başlıklara değineceğim:</p><ul><li>Unit/Integration/Automation Test</li><li>Hata yönetimini nasıl yapılmalı</li><li>Monitoring tooları</li><li>GitHub actionlarından nasıl faydalanılır</li><li>Bazı gerekli kütüphaneler</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed68e6fd3f2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript’de Map, Filter, Some, Every ve Reduce]]></title>
            <link>https://alimenekse.medium.com/javascriptde-map-filter-some-every-ve-reduce-5826666eb450?source=rss-1f19a6d18af2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5826666eb450</guid>
            <dc:creator><![CDATA[Ali Osman Menekse]]></dc:creator>
            <pubDate>Mon, 07 Jun 2021 13:11:39 GMT</pubDate>
            <atom:updated>2021-06-07T13:11:39.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*aqj67l6UZut8EqR3.png" /></figure><h3>Map</h3><p>Genellikle dizileri manüple edip yeni bir dizi oluşturmak istediğimizde kullanırız.</p><p>Örn: [2,4,7,9] elamlarından oluşan bir dizimiz olsun bu dizinin elemanlarının 2 katı olduğu yeni bir dizi oluşturmak istersek ;</p><pre><strong>let</strong> numbers =  [2,4,7,9]<br><strong>let</strong> doubleNumbers = numbers.map(number =&gt; number*2)console.log(doubleNumbers) //Çıktısı -&gt; [4, 8, 14, 18]</pre><blockquote><em>Neden forEach ile yapmadık ?<br>- Performans olarak map forEach fonksiyonundan daha hızlı çalışır.<br>- forEach geriye değer dönmediği için zincirlerde (method chaining) kullanılamaz.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*H3-gXrlVY38cdpym" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*uLZ-4TzgAYZgTO_S.png" /></figure><p>Map -forEach karşılaştırması (Oranlar ortama bağlı değişiklik gösterebilir)</p><h3>Filter</h3><p>Filter fonksiyonu belirli kriterden geçmiş yeni bir dizi döner.</p><p>Örn: [2,4,7,9] dizimiz var bu dizideki çift sayılara ulaşmak istiyoruz yani filtreleme yapmak olarak da düşünebiliriz.</p><pre>let numbers =  [2,4,7,9]<br>let evenNumbers = numbers.filter(number =&gt; number % 2 == 0)console.log(evenNumbers) //Çıktısı -&gt; [2,4]</pre><h3>Reduce</h3><p>Reduce fonksiyonu dizinin her elemanı kadar tanımlanan fonksiyonu çağırır bu fonksiyon 4 argüman alabilir (accumulator, value, index, array)</p><p>accumulator →return edilen son değer ( ilk çağırıldığında tanımlanan ilk değer)<br>value → dizinin o an dönen elemanı<br>index → dizinin o anki indexi<br>array → dizinin tamamı</p><p>Örnek : [2,4,7,9] dizimizin elemanlarını toplayalım;</p><pre>let numbers =  [2,4,7,9]<br>let firstValue = 0<br>const reducer = (acc, value) =&gt; accumulator + valueconsole.log(numbers.reduce(reducer,firstValue)) // Çıktısı -&gt; 22</pre><blockquote><strong><em>Çalışma Mantığı</em></strong><em> ; reduce her değer için tanımlanan reducer fonksiyonunu çağırır. Biz bu fonksiyonda arguman olarak dizinin elemanını ve tanımlanan ilk değeri alıyoruz bu iki değer ile gerekli işlemleri yapıp return ediyoruz. Reduce bizim için bu dönen değeri tutuyor ve fonksiyonu tekrar çağırdığında ilk değerin yerine bu değeri gönderiyor.</em></blockquote><h3>Some</h3><p>Some fonksiyonu arrayin içinde belirtilen kurala uyan en az bir eleman var ise true döner.</p><pre>let numbers =  [-2,4,7,9]<br>const isNegative = numbers.some( number =&gt; number &lt; 0 )console.log(isNegative) // Çıktısı -&gt; true</pre><h3>Every</h3><p>Every fonksiyonu arrayin içindeki tüm elemanlar belirtilen kurala uyarsa true döner</p><p>Örn: Dizimizdeki tüm elamanlar 0 dan büyük mü kontrol edelim;</p><pre>let numbers =  [2,4,7,9]<br>const isPositive = numbers.some( number =&gt; number &gt; 0 )console.log(isPositive) // Çıktısı -&gt; true</pre><h3>Chaining (Zincirleme)</h3><p>Map, filter ve reduce fonksiyonların çok kullanışlı olmasının dışında bir arada kullanılma gibi özellikleri de var. Anlattığım bu fonksiyonlar mevcut olan diziyi değiştirmek yerine yeni bir dizi döndürdüğü için bu dizilerden sonra yeni fonksiyonlar kullanabiliriz.</p><p>Örn: Dizimizde bulunan çift sayıları 2 ile toplayıp yeni bir dizi döndüren zincirimizi yazalım;</p><pre>let numbers = [2,4,7,9]<br>const isEven = (x) =&gt; x % 2 == 0<br>const addTwo = (x) =&gt; x + 2console.log(numbers.filter(isEven).map(addTwo)) //Çıktısı -&gt; [4,8]</pre><blockquote><em>Yararlı : JavaScript fonksiyonlarının performanslarını karşılaştırmak için </em><a href="https://jsperf.com/"><em>jsperf</em></a><em> sayfasını kullanabilirsiniz.</em></blockquote><blockquote><em>Kafanıza takılan bir yer olduysa mail yoluyla ya da Twitter’dan bana ulaşabilirsiniz.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5826666eb450" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>