<?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 Alican Erdurmaz on Medium]]></title>
        <description><![CDATA[Stories by Alican Erdurmaz on Medium]]></description>
        <link>https://medium.com/@alicanerdurmaz?source=rss-dcb4e9738264------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nzY-TeuTKooOHiSlAQGSlA.jpeg</url>
            <title>Stories by Alican Erdurmaz on Medium</title>
            <link>https://medium.com/@alicanerdurmaz?source=rss-dcb4e9738264------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:18:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alicanerdurmaz/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[JavaScript İpuçları #1]]></title>
            <link>https://alicanerdurmaz.medium.com/javascript-i%CC%87pu%C3%A7lar%C4%B1-1-48507c2a2cff?source=rss-dcb4e9738264------2</link>
            <guid isPermaLink="false">https://medium.com/p/48507c2a2cff</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Alican Erdurmaz]]></dc:creator>
            <pubDate>Wed, 10 Feb 2021 15:10:43 GMT</pubDate>
            <atom:updated>2021-02-10T15:13:29.506Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hd7Rd3ahaXjFBF5kn8mTrA.jpeg" /><figcaption>Brendan Eich</figcaption></figure><h3>console.log</h3><blockquote>En iyi hata ayıklama aracı 💩</blockquote><p>Değişkeni ismiyle birlikte console’a bastırmanın kolay yolu</p><pre>const foo = { name: &#39;John&#39;, age: &#39;30&#39;, happy: &#39;yes&#39; }<br>const bar = { name: &#39;Doe&#39;, age: &#39;40&#39;, happy: &#39;yes&#39; }<br>const baz = { name: &#39;Jack&#39;, age: &#39;50&#39;, happy: &#39;no&#39; }</pre><pre>console.log(foo, bar, baz) // Object Object Object</pre><pre>console.log({ foo, bar, baz }) // {foo:Object bar:Object baz:Object}</pre><pre>const x = 10<br>const y = 20<br>const z = 30</pre><pre>console.log(x, y, z) // 10 20 30<br>console.log({ x, y, z }) // {x: 10, y: 20, z: 30}</pre><p>console.log fonskiyonu CSS özelliklerini kullanmamızı bile sağlıyor 🥳</p><pre>console.log(&#39;%c Users&#39;, &#39;color:red&#39;)<br>console.table([foo, bar, baz])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*qSw44IvHJM-NRRl38xDIhg.png" /></figure><h3>Short-Circuit Evaluation</h3><p>Default değer atamak veya koşulla göre işlem gerçekleştirirken çoğu zaman bu yöntemi kullanmak daha temiz oluyor.</p><pre>const state = {<br>  data: null,<br>}</pre><pre>console.log(state.data || &#39;Fetching Data&#39;) // Fetching Data</pre><pre>--------------------------------------------------------------------</pre><pre>function Hello() {<br>  console.log(&#39;Hello&#39;)<br>}</pre><pre>const flag = true</pre><pre>if (flag) {<br>  Hello() // Hello<br>}</pre><pre>flag &amp;&amp; Hello() // Hello</pre><h3>Ternary Operator</h3><p>if-else göre çok daha güzel gözüküyor ve <br>const değişkene bu sayede rahatlıkla koşullu değer atılabiliyor.</p><pre>const score = 100<br>const grade = score &lt; 100 ? &#39;FAIL&#39; : &#39;PASS&#39;<br>console.log(grade) // PASS</pre><h3>Spread Syntax {…}</h3><p>Bunun kullanım örneklerini yaz yaz bitmez. <br>Her şeyi kolaylaştırma gücü var 🪄</p><pre>const numbers = [5, 6, 9, 4, 1, 2, 10, 8, 3, 7]</pre><pre>const min = Math.min(...numbers)<br>const max = Math.max(...numbers)</pre><pre>console.log({ max, min }) // {max: 10, min: 1}</pre><p>Döngüye gerek yok, tek tek push’lamaya gerek yok. 3 Nokta yeter 😌</p><pre>let pokemons = [&#39;Pikachu&#39;, &#39;Bulbasaur&#39;, &#39;Charmander&#39;]</pre><pre>pokemons.push(&#39;Raichu&#39;)<br>pokemons.push(&#39;Ivysaur&#39;)<br>pokemons.push(&#39;Charmeleon&#39;)</pre><pre>pokemons = [...pokemons, &#39;Raichu&#39;, &#39;Ivysaur&#39;, &#39;Charmeleon&#39;]</pre><p>Oyun programladığımızı ve karakterimizin seviye atladığını düşünelim. Özelliklerini güncellemek 3 nokta ile çok kolay !</p><pre>const statLvl1 = { hp: 70, attack: 20 }</pre><pre>let player = { name: &#39;Pikachu&#39;, hp: 50, attack: 10 }</pre><pre>player = { ...player, ...statLvl1 }<br>console.log(player) // {name: &quot;John&quot;, hp: 70, attack: 20}</pre><p>3. parameteyi yollayarak “statLvl1&quot; objesindeki istemediğimiz değerin üzerine yazmak da mümkün</p><pre>player = { ...player, ...statLvl1, hp: 10 }</pre><pre>console.log(player) // {name: &quot;John&quot;, hp: 10, attack: 20}</pre><p>tek satırda “Unique List” yapmak 🤯</p><pre>const numbers = [1, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 10]</pre><pre>const uniqueNumbers = [...new Set(numbers)]</pre><pre>console.log(uniqueNumbers) // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10</pre><h3>Destructuring</h3><p>Kodumuzu kısaltmak ve kalabalıklığı azaltmak için hepimiz “Object Destructuring” sıklıkla kullanıyoruz.</p><p>JavaScript’te her şey objelerden türediği için bunu “Array” lere de kullanmak ve “Array” den “length” propertysini almak da mümkün oluyor.</p><blockquote>Array’in ilk ve son elemanını alma örneği</blockquote><pre>const pokemons = [&#39;Pikachu&#39;, &#39;Bulbasaur&#39;, &#39;Charmander&#39;, &#39;Raichu&#39;]</pre><pre>const { length, 0: first, [length - 1]: last } = pokemons</pre><pre>console.log({ length, first, last }) <br>output -&gt; {length: 6, first: &quot;Pikachu&quot;, last: &quot;Raichu&quot;}</pre><h3>Default Function Parameters</h3><p>Paremetreye default değeri, diğer parametreden alabiliriz</p><pre>function showModal(title, closeButtonText = `Close ${title}`) {<br>  console.log(closeButtonText)<br>}</pre><pre>showModal(&#39;Login Form&#39;) // Close Login Form<br>showModal(&#39;Login Form&#39;, &#39;Exit Form&#39;) // Exit Form</pre><h3>JavaScript <strong>Intl</strong></h3><p>JavaScript’in Internationalization API’ı derya deniz. Israrla dökümantasyonunu iyice incelemenizi öneriyorum.</p><p>Muhtemelen moment.js , DayJS gibi kütüphanelere ihtiyacınız kalmayacak.</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl</a></p><p>Güzelliğini göstermek için küçük bir örnek 🙂</p><pre>const relative = new Intl.RelativeTimeFormat(&#39;en&#39;, { style: &#39;long&#39;, numeric: &#39;auto&#39; })</pre><pre>relative.format(3, &#39;day&#39;) // in 3 days<br>relative.format(-3, &#39;day&#39;) // 3 days ago<br>relative.format(5, &#39;second&#39;) // in 5 seconds<br>relative.format(-5, &#39;second&#39;) // 5 seconds ago<br>relative.format(1, &#39;day&#39;) // tomorrow<br>relative.format(-1, &#39;day&#39;) // yesterday<br>relative.format(-1, &#39;year&#39;) // last year</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48507c2a2cff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>