<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arsen Mazmanyan</title>
    <description>The latest articles on DEV Community by Arsen Mazmanyan (@arsenmazmanyan1104).</description>
    <link>https://dev.to/arsenmazmanyan1104</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F578229%2F8fc2993c-0bca-4e2b-9a8c-53248a62eb63.jpeg</url>
      <title>DEV Community: Arsen Mazmanyan</title>
      <link>https://dev.to/arsenmazmanyan1104</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arsenmazmanyan1104"/>
    <language>en</language>
    <item>
      <title>Գտնել զանգվածների ընդհանուր էլեմենտները</title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Mon, 20 Dec 2021 09:31:30 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/gtnel-zangvatsneri-endhanowr-elementnere-5g6f</link>
      <guid>https://dev.to/arsenmazmanyan1104/gtnel-zangvatsneri-endhanowr-elementnere-5g6f</guid>
      <description>&lt;h2&gt;
  
  
  Բարև սիրելի ծրագրավորող (կամ ապագա ծրագրավորող)։
&lt;/h2&gt;

&lt;p&gt;Այսօր կնայենք հարցազրույցների ժամանակ ամենատարածված խնդիրներից մեկը՝ &lt;strong&gt;մի մի քանի զանգվածի ընդհանուր էլեմենտները գտնելու&lt;/strong&gt; խնդիրը և այդ խնդրի լուծման եղանակներից մի քանիսը։&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Սակայն մինչև առաջ անցնելը 2 կարևոր բան&lt;/strong&gt;&lt;br&gt;
֊ Խնդիրների լուծումները կլինեն JavaScript լեզվով,&lt;br&gt;
֊ Ես ներկայացնում եմ խնդիրը լուծելու գաղափարները և չեմ բացատրելու, թե որ ֆունկցիան իրենից ինչ է ներկայացնում, սակայն կտեղադրեմ համապատասխան հղումները, որպեսզի դու ինքդ ուսումնասիրես դրանք:&lt;/p&gt;

&lt;p&gt;Եթե սիրում ես խնդիրներ լուծել, ուրեմն արդեն լուծել ես այսպիսի խնդիր։ Կամ հարցազրույցի ժամանակ առընչվել ես այսպիսի խնդրի։&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Նախ հասկանանք խնդիրը։&lt;/strong&gt;&lt;br&gt;
Ո՞ր էլեմենտներն են, որ կարող ենք համարել ընդհանուր։ &lt;br&gt;
Եթե կա այնպիսի էլեմենտ, որը պարունակվում է մեզ տրված զանգվածներից յուրաքանչյուրում, ապա այն համարվումէ  ընդհանուր էլեմենտ։&lt;/p&gt;

&lt;p&gt;Այսինքն, եթե ստացել ենք 3 զանգված՝&lt;br&gt;
  ["a", "b", "a", "b", "d", "c"],&lt;br&gt;
  ["a", "c", "d", "e", "e"],&lt;br&gt;
  ["a", "x", "y", "c"],&lt;/p&gt;

&lt;p&gt;Այս դեպքում մեր պատասխանը կլինի 'a','c': Որովհետև դրանք այն էլեմենտներն են, որոնք պարունակվում են մեր զանգվածներից բոլորի մեջ։&lt;/p&gt;

&lt;p&gt;Ինչպես գրեթե ցանկացած խնդիր, այս խնդիրը նույնպես ունի իր տարատեսակները։ Այդ պատճառով հստակցնենք որոշակի պայմաններ։&lt;/p&gt;

&lt;p&gt;Մեզ կփոխանցվի երկչափ զանգված, որի մեջի զանգվածներից պետք է գտնենք ընդհանուր էլեմենտները։ Մեր զանգավծները պարունակելու են միայն տառեր։ Զանգվածների երկարությունը չի գերազանցում 100֊ը։  Զանգվածների քանակը 1֊ից ավել է։ Զանգվածների մեջ էմենետները կարող են կրկնվել (['a', 'b', 'a', 'b', 'c']), սակայն այդ դեպքում հաշվում ենք դրանցից միայն մեկը։ Որպես պատասխան վերադարձնում ենք զանգված, որի մեջ ներառված են ընդհանուր էլեմենտները։&lt;/p&gt;




&lt;p&gt;Լուծման գաղափարներից մեկը այն է, որ վերցնենք զանգվածերից մեկի էլեմենտները և ստուգենք, թե դրանցից որոնք են պարունակվում մնացած զանգվածներում։ Եթե գտնենք այնպիսի զանգված, որը չի պարունակում տվյալ էլեմենտը, կանցնենք առաջ և կստուգենք հաջորդ էլեմենտը։ Իսկ եթե հասնենք վերջին զանգվածին և այն նույնպես պարունակի տվյալ էլեմենտը, նշանակում է այն պարունակվում է բոլոր զանգվածներում։ Հակառակ դեպքում նախորդ պայմանով արդեն դուրս եկած կլինեինք ցիկլի մեջից և վերջին զանգվածին չէինք հասնի։&lt;/p&gt;

&lt;p&gt;Սակայն, ինչպես նշեցի, զանգվածների մեջ էլեմենտները կարող են կրկնվել, իսկ զանգվածի միջից դուպլիկատները հեռացնելու համար կօգտվեմ Set-ից (Զանգվածի միջից դուպլիկատները հեռացնելու խնդրին և դրա լուծումներին &lt;a href="https://dev.to/arsenmazmanyan1104/zangvatsits-dowplikatner-herhatsnelow-algoritmner-1gpk"&gt;կարող ես ծանոթանալ այստեղ&lt;/a&gt;)։&lt;/p&gt;

&lt;p&gt;Ստորև ներկայացրել եմ 2 լուծում, որոնք միմյանցից տարբերվում են միայն զանգվածի մեջ էլեմենտը գտնելու մեթոդով։ Մի դեպքում օգտագործվում է &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf" rel="noopener noreferrer"&gt;Array.indexOf()&lt;/a&gt; մեթոդը, մյուս դեպքում &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/includes" rel="noopener noreferrer"&gt;Array.includes()&lt;/a&gt;֊ը։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw82ubh6gdv5nazuhwhdu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw82ubh6gdv5nazuhwhdu.png" alt="javascript algorithm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/mdBwzxN?editors=0011" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Այս խնդիրը կարող ենք լուծել նաև ուրիշ ձևով։ Նախ պետք է զանգվածների միջից հեռացնենք դուպլիկատները, որից հետո մնում է հաշվենք, թե յուրաքանչյուր էլեմենտ քանի անգամ է հանդիպում մեզ տրված զանգվածների մեջ։ Եթե կա էլեմենտ, որին հանդիպում ենք այնքան, ինչքան մեր զանգվածների քանակն է, ուրեմն այդ էլեմենտը հանդիպում է բոլոր զանգվածներում։ Վստահ կարող ենք այսպիսի պնդում կատարել, քանի որ նախորդ քայլով արդեն հեռացրել էինք յուրաքանչյուր զանգվածում գտնվող դուպլիկատները։&lt;/p&gt;

&lt;p&gt;Էլեմենտների հանդիպելու քանակը հաշվելու համար կօգտագործենք օբյեկտ, որի մեջ որպես key կպահենք այն տառը, որի քանակը հաշվելու ենք, իսկ որպես այդ key֊ի property կպահենք նրան հանդիպելու քանակը։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr1cbcpjyzx3irr1d8v7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr1cbcpjyzx3irr1d8v7u.png" alt="javascript algorithm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/abLwRqK?editors=0011" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Հույս ունեմ, այս նյութը քեզ օգնեց նոր գաղափարներ և նոր գիտելիք ստանալու հարցում։ Իսկ եթե ունես այնպիսի լուծման եղանակ, որը այստեղ նշված չէ, շատ ուրախ կլինեմ, &lt;a href="https://t.me/Beardman1104" rel="noopener noreferrer"&gt;եթե քո տարբերակը ուղարկես ինձ&lt;/a&gt;, այդպիսով փորձի փոխանակում կանենք։&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Արդյո՞ք թիվը պարզ է (Prime Numbers)</title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Fri, 03 Dec 2021 10:26:34 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/ardyok-tive-parz-e-prime-numbers-af6</link>
      <guid>https://dev.to/arsenmazmanyan1104/ardyok-tive-parz-e-prime-numbers-af6</guid>
      <description>&lt;h2&gt;
  
  
  Բարև սիրելի ծրագրավորող (կամ ապագա ծրագրավորող)։
&lt;/h2&gt;

&lt;p&gt;Այսօր կնայենք հարցազրույցների ժամանակ ամենատարածված խնդիրներից մեկը՝ &lt;strong&gt;թվի պարզությունը ստւգելու&lt;/strong&gt; խնդիրը և այդ խնդրի լուծման եղանակներից մի քանիսը։&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Սակայն մինչև առաջ անցնելը 2 կարևոր բան&lt;/strong&gt;&lt;br&gt;
֊ Խնդիրների լուծումները կլինեն JavaScript լեզվով,&lt;br&gt;
֊ Ես ներկայացնում եմ խնդիրը լուծելու գաղափարները և չեմ բացատրելու, թե որ ֆունկցիան իրենից ինչ է ներկայացնում, սակայն կտեղադրեմ համապատասխան հղումները, որպեսզի դու ինքդ ուսումնասիրես դրանք:&lt;/p&gt;

&lt;p&gt;Եթե սիրում ես խնդիրներ լուծել, ուրեմն արդեն լուծել ես այսպիսի խնդիր։ Կամ հարցազրույցի ժամանակ առընչվել ես այսպիսի խնդրի։&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Նախ հասկանանք խնդիրը։&lt;/strong&gt;&lt;br&gt;
Ո՞ր թվերն են համարվում պարզ թվեր։&lt;br&gt;
Պարզ թիվ է կոչվում այն բնական թիվը (բացի 1-ից), որը ունի միայն երկու բաժանարար։ Այսինքն բաժանվում են միայն մեկի և իր վրա ։&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ի՞նչպես կարող ենք ստուգել թվի պարզ լինելը։&lt;/strong&gt;&lt;br&gt;
Ենթադրենք մեզ տրված թիվը &lt;code&gt;N&lt;/code&gt; թիվն է։&lt;br&gt;
Պարզապես կարող ենք մինչև &lt;code&gt;N&lt;/code&gt; բոլոր թվերը հերթով ստուգել և եթե գտնենք 1֊ից և &lt;code&gt;N&lt;/code&gt;֊ից տարբեր այնպիսի թիվ, որի վրա &lt;code&gt;N&lt;/code&gt;֊ը բաժանելիս ստանում ենք 0 մնացորդ, ուրեմն թիվը պարզ չէ։&lt;/p&gt;

&lt;p&gt;Ընդունենք, որ մեր ֆունկցիային փոխանցվող արգումենտը միշտ 1֊ից տարբեր բնական թիվ է լինելու {2,3,4,5,...}:&lt;/p&gt;

&lt;p&gt;Մեզ պետք է գտնենլ 1֊ից և N֊ից տարբեր թիվ, հետևաբար կարող ենք ստուգել &lt;code&gt;[2, N-1]&lt;/code&gt; միջակայքի թվերը, ներառյալ։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksfmlenmfqqa6a09o64v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fksfmlenmfqqa6a09o64v.png" alt="code javascript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/NWaqJJO?editors=0011" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Այս եղանակի վրա կարող ենք որոշակի օպտիմիզացիաներ կատարել։&lt;br&gt;
Օրինակ կարող ենք ստուգել մինչև &lt;code&gt;N/2&lt;/code&gt;, որովհետև &lt;code&gt;(N/2, n]&lt;/code&gt; միջակայքում այնպիսի թիվ չկա, որի վրա բաժանելիս կստանանք` ամբողջ թիվ (կստանանք 1ից մեծ և 2ից փոքր թվեր)։ Այսպիով մեր քալերի քանակը 2 անգամ կկրճատվի։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F01786l7pvlxxk6rwe7yh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F01786l7pvlxxk6rwe7yh.png" alt="code javascript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/rNGVREa?editors=0011" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Սակայն կա մեկ այլ, ավելի օպտիմալ տարբերակ, որը սկզբից կբացատրեմ մաթեմատիկական եղանակով։&lt;/p&gt;

&lt;p&gt;Ցանկացած բնական, ոչ պարզ &lt;code&gt;N&lt;/code&gt; թիվ կարող ենք ներկայացնել &lt;code&gt;A * B&lt;/code&gt; տեսքով, որտեղ &lt;code&gt;A, B&lt;/code&gt;֊ն նույնպես բնական թվեր են։&lt;br&gt;
Ունենք &lt;code&gt;M&lt;/code&gt; դրական իրական թիվը, որը &lt;code&gt;N&lt;/code&gt; թվի քառակուսի դրական արմատն է՝ M = |√ N|:&lt;/p&gt;

&lt;p&gt;Քանի որ &lt;code&gt;M * M = N&lt;/code&gt; և &lt;code&gt;N = A * B&lt;/code&gt;, ապա &lt;code&gt;M * M = A * B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Նկատենք, որ ստորև նշված 3 պայմաններից մեկը միշտ տեղի ունի։&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;A &amp;gt; M =&amp;gt; B &amp;lt; M&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;A = M =&amp;gt; B = M&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;A &amp;lt; M =&amp;gt; B &amp;gt; M&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Բոլոր 3 դեպքերի համար 1 ընդհանուր բան կա՝ &lt;code&gt;(A,B)&lt;/code&gt;-ից փոքրագույնի արժեքը փոքր կամ հավասար է &lt;code&gt;M&lt;/code&gt;֊ից &lt;code&gt;(min(A,B) ≤ M)&lt;/code&gt;:&lt;br&gt;
Հետևաբար նրանցից մեծագույնը մեծ կամ հավասար է &lt;code&gt;M&lt;/code&gt;֊ից &lt;code&gt;(max(A,B) ≤ M)&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;Այսինքն, եթե &lt;code&gt;N&lt;/code&gt; թիվը պարզ չէ, ուրեմն &lt;code&gt;[2,M]&lt;/code&gt; միջակայքում գոյություն ունի գոնե 1 այնպիսի թիվ, որի վրա &lt;code&gt;N&lt;/code&gt;֊ը առանց մնացորդ բաժանվում է։ Հակառակ դեպքում թիվը պարզ է։&lt;/p&gt;

&lt;p&gt;Այս ալգորիթմը էլ ավելի քիչ քայլում է կատարվում, քայլերի քանակը հասցնելով √N֊ի։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8i7urze2qy7977rf0rjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8i7urze2qy7977rf0rjl.png" alt="code javascript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/dyVoLPR?editors=0011" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Հույս ունեմ, այս նյութը քեզ օգնեց նոր գաղափարներ և նոր գիտելիք ստանալու հարցում։ Իսկ եթե ունես այնպիսի լուծման եղանակ, որը այստեղ նշված չէ, շատ ուրախ կլինեմ, &lt;a href="https://t.me/Beardman1104" rel="noopener noreferrer"&gt;եթե քո տարբերակը ուղարկես ինձ&lt;/a&gt;, այդպիսով փորձի փոխանակում կանենք։&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Այլ մարդկանց կողմից առաջարկված լուծումներ (մաս 1) </title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Mon, 29 Nov 2021 15:58:57 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/lowtsowmner-ayl-mardkants-koghmits-3fak</link>
      <guid>https://dev.to/arsenmazmanyan1104/lowtsowmner-ayl-mardkants-koghmits-3fak</guid>
      <description>&lt;h2&gt;
  
  
  Բարև սիրելի ծրագրավորող
&lt;/h2&gt;

&lt;p&gt;Նախորդ 2 փոստերում մենք քննարկեցինք &lt;a href="https://dev.to/arsenmazmanyan1104/zangvatsits-dowplikatner-herhatsnelow-algoritmner-1gpk"&gt;տառերի զանգվածի միջից դուպլիկատները հեռացնելու&lt;/a&gt; և &lt;a href="https://dev.to/arsenmazmanyan1104/polindrom-palindrome-barher-3d48"&gt;բառի պոլինդրոմությունը ստուգելու&lt;/a&gt; խնդիրները և դրանց լուծման մի քանի տարբերակ։&lt;/p&gt;

&lt;p&gt;Ի ուրախություն ինձ, ինչու չէ նաև քեզ, որոշ մարդիկ այս նյութերը կարդալուց հետո իմ հետ կիսվեցին այս խնդիրները լուծելու իրենց նոր, հետաքրքիր տարբերակներով, որոնցով ես պատրաստվում եմ կիսվել քո հետ։&lt;/p&gt;

&lt;p&gt;Սկզբից նայենք տառերի զանգվածի միջից դուպլիկատները հեռացնելու խնդրի նոր լուծումները։ Խնդրի հետ ավելի մանրամասն ծանոթանալու համար կարող ես անցնել &lt;a href="https://dev.to/arsenmazmanyan1104/zangvatsits-dowplikatner-herhatsnelow-algoritmner-1gpk"&gt;այս հղմամբ&lt;/a&gt;։ &lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Այս տարբերակը LinkedIn-ով ինձ առաջարկել է &lt;a href="https://www.linkedin.com/in/sahak-k-631300123"&gt;Սահակը&lt;/a&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pAFBLqdS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mqavy9mnh7ekkjcfclti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pAFBLqdS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mqavy9mnh7ekkjcfclti.png" alt="code javascript algorithm" width="768" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/KKXKdrd"&gt;Կոդը կարող ես փորձարկել այստեղ&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;Լուծման այս տարբերակը հիմնված է JavaScrip-ի օբյեկտի՝ եզակի key֊եր պահելու վրա։ Զանգվածի էլեմենտներով &lt;code&gt;obj&lt;/code&gt; օբյեկտի key֊եր ենք սարքում։ Այնուհետև վերադարձնում ենք &lt;code&gt;obj&lt;/code&gt;֊ի key֊երը զանգվածի տեսքով և խնդիրը լուծված է։&lt;/p&gt;

&lt;p&gt;Իհարկե  գաղափարին հետևող այլ լուծումներ էլ կարող եք ստանալ։ Ես և Սահակը արել ենք այդ։ Կցանկանամ, որ նաև դուք մտածեք այդ ուղղությամբ և ինքներդ այլ լուծումներ գտնեք։&lt;/p&gt;

&lt;p&gt;Նա նաև առաջարկեց Go լեզվով մեկ այլ լուծում, որը ունի այսպիսի տեսք։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--537Z7TiF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfudrm4kf5j02ab77qwe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--537Z7TiF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfudrm4kf5j02ab77qwe.png" alt="code go algorithm" width="644" height="776"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Մյուս տարբերակը ինձ առաջարկել է &lt;a href="https://t.me/javascriptarmenia"&gt;JavaScript Armenia&lt;/a&gt; Տելեգրամ չատի օգտատեր Կարոն&lt;/strong&gt;։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_Wx9WuJ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xg5hqeg5fhbl3ad10u5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_Wx9WuJ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xg5hqeg5fhbl3ad10u5k.png" alt="code javascript algorithm" width="880" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/LYzYGGB"&gt;Կոդը կարող ես փորձարկել այստեղ&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;Լուծման այս եղանակը հիմնված է ES6 ստանդարտով մեզ ներկայացած ֆունկցիաների վրա։ Այս դեպքում զանգվածը ֆիլտրում ենք և պահում ենք միայն այն էլեմենտները, որոնց ինդեքսը հավասար է այդ զանգվածում իրեն հավար էլեմենտի վերջին ինդեքսին։ Այսինք էլեմենտը մնում է միայն այն դեպքում, երբ այն միակն է զանգվածում։&lt;/p&gt;




&lt;p&gt;Անցնենք առաջ և դիտարկենք պոլինդրոմ բառերի խնդրի համար առաջարկված նոր լուծումները։ Այս խնդրի հետ ավելի մանրամասն ծանոթանալու համար կարող ես անցնել &lt;a href="https://dev.to/arsenmazmanyan1104/polindrom-palindrome-barher-3d48"&gt;այս հղմամբ&lt;/a&gt;։ &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Այս խնդրի լուծումներից մեկը ինձ LinkedIn֊ով առաջարկել է &lt;a href="https://www.linkedin.com/in/gurgen-alaverdyan-9732321a8"&gt;Գուրգենը&lt;/a&gt;&lt;/strong&gt;: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3kfdAacO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g5q6ycukold2irpg8l3y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3kfdAacO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g5q6ycukold2irpg8l3y.png" alt="code javascript algorithm" width="796" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/LYzYGGB"&gt;Կոդը կարող ես փորձարկել այստեղ&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;Խնդրի լուծման այս տարբերակում պահում ենք 2 ինդեքս, որոնցից մեկը աջ կողմից ստուգվող էլեմենտի ինդեքսն է, մյուսը ձախ կողմից ստուգվողի ինդեքսը։ Ամեն անգամ, տառերի համեմատությունից հետո, եթե նրանք հավասար են, ինդեքսները 1ով ավելացնում ենք, քանի դեռ ձախ ինդեքսը փոքր է աջի ինդեքսից։ Իսկ եթե տառերը նույնը չեն, վերադարձնում ենք &lt;code&gt;false&lt;/code&gt;։&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Մեկ այլ լուծում առաջարկել է &lt;a href="https://t.me/ArmenianITCommunity"&gt;Հայկական ՏՏ համայնք&lt;/a&gt; Տելեգրամ չատի օգտատեր Հասմիկը&lt;/strong&gt;։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JESyWTQh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hq98ks25k8tulepy7phd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JESyWTQh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hq98ks25k8tulepy7phd.png" alt="code javascript algorithm" width="745" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/KKXKpPQ"&gt;Կոդը կարող ես փորձարկել այստեղ&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;Այս Եղանակով մենք նախ բառը դարձնում ենք փոքրատառ, հետո պահում ենք այն նաև շրջած տեսքով։ Եթե բառը հավասար է իր շրջած արժեքին, ուրեմն այն պոլինդրոմ է։ Հակառակ դեպքում ոչ։ &lt;/p&gt;




&lt;p&gt;Եվս մեկ անգամ կցանկանամ շնորհակալություն հայտնել նրանց՝ իրենց լուծման տարբերակներով կիսվելու համար։&lt;/p&gt;

&lt;p&gt;Հույս ունեմ, այս նյութը քեզ օգնեց նոր գաղափարներ և նոր գիտելիք ստանալու հարցում։&lt;br&gt;
Իսկ եթե ունես մեկ այլ լուծման եղանակ, շատ ուրախ կլինեմ, &lt;a href="https://t.me/Beardman1104"&gt;եթե քո տարբերակը ուղարկես ինձ&lt;/a&gt;, այդպիսով փորձի փոխանակում կանենք։&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Պոլինդրոմ (palindrome) բառեր</title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Sun, 21 Nov 2021 09:10:11 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/polindrom-palindrome-barher-3d48</link>
      <guid>https://dev.to/arsenmazmanyan1104/polindrom-palindrome-barher-3d48</guid>
      <description>&lt;h2&gt;
  
  
  Բարև սիրելի ծրագրավորող (կամ ապագա ծրագրավորող)։
&lt;/h2&gt;

&lt;p&gt;Այսօր կնայենք հարցազրույցների ժամանակ ամենատարածված խնդիրներից մեկը՝ &lt;strong&gt;պոլինդրոմ բառերի&lt;/strong&gt; խնդիրը։&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Սակայն մինչև առաջ անցնելը 2 կարևոր բան&lt;/strong&gt;&lt;br&gt;
֊ Խնդիրների լուծումները կլինեն JavaScript լեզվով,&lt;br&gt;
֊ Ես ներկայացնում եմ խնդիրը լուծելու գաղափարները և չեմ բացատրելու, թե որ ֆունկցիան իրենից ինչ է ներկայացնում, սակայն կտեղադրեմ համապատասխան հղումները, որպեսզի դու ինքդ ուսումնասիրես դրանք:&lt;/p&gt;

&lt;p&gt;Եթե սիրում ես խնդիրներ լուծել, ուրեմն արդեն լուծել ես այսպիսի խնդիր։ Կամ հարցազրույցի ժամանակ առընչվել ես այսպիսի խնդրի։&lt;/p&gt;

&lt;p&gt;Նախ հասկանանք խնդիրը։&lt;br&gt;
Ի՞նչ է իրենից ներկայացնում պոլինդրոմ բառը։ &lt;strong&gt;Պոլինդրոմ&lt;/strong&gt; կոչվում են այն բառեր/թվերը, որոնք թե՛ աջից, թե՛ ձախից նույն կերպ են կարդացվում։ Այդպիսի բառերի օրինակներից են «շիշ», «Աննա» և նմանատիպ կառուցվածք ունեցող բառերը։ Իսկ թվերից «12321», «12344321» և նմանատիպ մնացած թվերը։&lt;/p&gt;

&lt;p&gt;Սակայն ինչպե՞ս վարվել երբ բառի/թվի երկարությունը կենտ թիվ է։ Այսինքն մեջտեղում ունենալու ենք մի տառ, որը ոչ մեկի հետ չենք կարող ստուգել։ Պարզվում է, այս դեպքում մեջտեղի տառը ստուգելու կարիք չկա, որովհետև այն չի ազդում բառի պոլինդրոմության վրա։&lt;/p&gt;

&lt;p&gt;Հիմա փորձենք հասկանանք, թե ինչպես կարող ենք լուծել այս խնդիրը։ Պարզվում է, դա այդքան էլ բարդ չէ։ Ուղղակի պետք է առաջին տառը/նիշը համեմատենք վերջից առաջին տառի/նիշի հետ։ Եթե տառերը/նիշերը նույնն են, անցնում ենք առաջ և երկրորդը համեմատում ենք վերջից երկրորդի հետ։ Այդ ամենը անում ենք այնքան, մինչև գտնենք այնպիսի տառերի/նիշերի զույգ, որոնք նույնը չեն։ Այդ դեպքում տրված բառը/թիվը կդադարի պոլինդրոմ լինելուց։ Հակառակ դեպքում, եթե չգտնենք այդպիսի զույգ, ուրեմն թիվը պոլինդրոմ է։&lt;/p&gt;

&lt;p&gt;Ծրագրավորման տեսանկյունից ինչպե՞ս կարող ենք հասկանալ բառի/թվի պոլինդրոմությունը։&lt;/p&gt;

&lt;p&gt;Գաղափարներից մեկը, որ գալիս է, այն է, որ վերցնենք երկու զանգված, մեկի մեջ տեղավորենք առաջին կեսի տառերը, մյուսի մեջ երկրորդ կեսի տառերը։ Հետո համեմատենք զանգվածների համապատասխան տառերը։&lt;/p&gt;

&lt;p&gt;Եթե բառի երկարությունը կենտ թիվ է, ապա պետք է անել այնպես, որ այդ տառը ոչ մի զանգվածի մեջ չգտնվի, քանի որ այն գտնվում է հենց մեջտեղում և չի ազդում բառի պոլինդրոմության վրա։ &lt;/p&gt;

&lt;p&gt;Դե ինչ, անցնենք առաջ և դիտարկենք այս խնդիրը կոդի տեսանկյունից։&lt;/p&gt;

&lt;p&gt;Ընդունենք, որ այս խնդրի դեպքում մեր ֆունկցիային միշտ string տիպի արժեք է փոխանցվելու, որը կարող է ունենալ թե՛ մեծատառ, թե՛ փոքրատառ տառեր։ Սակայն տառի մեծատառ և փոքրատառ լինելը չի ազդում պոլինդրոմության վրա։ Ընդունենք նաև այն, որ փոխանցվող արժեքը կարող է դարակ լինել (&lt;em&gt;դատարկ stirng֊ը (""֊ը) կարող ենք պոլինդրոմ համարել&lt;/em&gt;)։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftoous3ulstjfd1dvvi59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftoous3ulstjfd1dvvi59.png" alt="code javascript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/ZEJdQrP?editors=0012" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Այս լուծման օրինակում մենք հայտարարում ենք 2 զագնված։ &lt;code&gt;firstHalf&lt;/code&gt;֊ի մեջ տեղավորում ենք բառի առաջին կեսի տառերը, իսկ &lt;code&gt;secondHalf&lt;/code&gt;֊ի մեջ երկրորդ կեսի տառերը։&lt;/p&gt;

&lt;p&gt;Երկրորդ զանգավծը շրջենք &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse" rel="noopener noreferrer"&gt;&lt;code&gt;reverse()&lt;/code&gt;&lt;/a&gt; մեթոդի օգնությամբ։ Հետո ստուգենք &lt;code&gt;firstHalf&lt;/code&gt;֊ի առաջին տառը &lt;code&gt;secondHalf&lt;/code&gt;֊ի առաջին տառի հետ։ Հետո &lt;code&gt;firstHalf&lt;/code&gt;֊ի երկրորդ տառը &lt;code&gt;secondHalf&lt;/code&gt;֊ի երկրորդ տառի հետ և այդպես շարունակ։ Եթե գտնենք այնպիսի տառերի զույգ, որոնք նույնը չեն, դա նշանակում է, որ բառը պոլինդրոմ չէ։ Հակառակ դեպքում այն պոլինդրոմ է։&lt;/p&gt;

&lt;p&gt;Իհարկե, այս տարբերակի վրա կարող ենք որոշակի փոփոխություններ կատարել, որոնք կարող են կոդը ավելի քիչ դարձնել, իսկ ալգորիթմը ավելի օպտիմալ։&lt;/p&gt;

&lt;p&gt;Սակայն եկեք դիտարկենք լուծման այլ տարբերակ։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdm01f5nw07079mlf0vo9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdm01f5nw07079mlf0vo9.png" alt="code javascript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/PoKrZVE?editors=0012" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ինչպես արդեն նշեցի, մենք պետք է ստուգենք տրված բառի առաջին մասը երկրորդ մասի հետ։ Այսինքն &lt;code&gt;for loop&lt;/code&gt;֊ը կարող ենք իրականացնել բառի երկարության կեսի չափով (&lt;code&gt;str.length/2&lt;/code&gt;): Որպեսզի կոդը ավելի պարզ լինի, ես &lt;code&gt;charFromFirstHalf&lt;/code&gt;֊ին վերագրում եմ բառի առաջին կեսից վերցրած հերթական տառը, իսկ &lt;code&gt;charFromSecondHalf&lt;/code&gt;֊ին վերագրում եմ բառի երկրորդ կեսից նրան համապատասխանող  տառը։ Այդ տառերը &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase" rel="noopener noreferrer"&gt;&lt;code&gt;toLowercase()&lt;/code&gt;&lt;/a&gt; մեթոդի միջոցով կդարձնենք փոքրատառ, քանի որ տառերի համեմատություն անելիս համեմատվում են տառերի &lt;a href="https://developer.mozilla.org/ru/docs/Glossary/ASCII" rel="noopener noreferrer"&gt;&lt;code&gt;ASCII&lt;/code&gt;&lt;/a&gt; կոդերը, որոնք ամեն սիմվոլի համար տարբեր են (օր․ "A" տառի ASCII կոդը 65 է իսկ "a" տառինը 97):&lt;br&gt;
Քանի որ կոդը JavaSript լեզվով է և այստեղ զանգվածի ինդեքսավորումը սկսվում է 0֊ից, հետևաբար զանգվածի երկարության և զանգվածի վեջին էլեմենտի ինդեքսի թվերը իրարից 1֊ով տարբերվում են։ Այդ պատճառով երկրորդ կեսից համապատասխան ինդեքսը կվերցնեմ &lt;code&gt;str.length-1-i&lt;/code&gt; ձևով։&lt;/p&gt;

&lt;p&gt;Դե, ինչպես նշեցի, մեր վերցրած տառերը պիտի համեմատենք։ Եթե նրանք հավասար չեն, դա նշանակում է, որ բառը պոլինդրոմ չէ։ Տառերի հավասար չլինելու դեպքում կարող ենք ֆունկցիան դադարեցնել և վերադարձնել &lt;code&gt;false&lt;/code&gt; արժեքը։&lt;/p&gt;

&lt;p&gt;Հակառակ դեպքում, երբ բոլոր տարռերի զույգերը հավասար են, for loop֊ը հաջողությամբ կավարտվի և կանցնենք առաջ ու կվերադարձնենք &lt;code&gt;true&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;Այս նույն գաղափարը կարող ենք իրագործել նաև &lt;code&gt;while&lt;/code&gt;֊ի օգնությամբ։ Այդ դեպքում մեր կոդը կունենա այս տեսքը։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8xzldmqyus9nf5xqvg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv8xzldmqyus9nf5xqvg6.png" alt="code javascript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/b11rdman/pen/bGrPEZj?editors=0012" rel="noopener noreferrer"&gt;Կոդը տեղադրված է այս հղման մեջ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Հույս ունեմ, այս նյութը քեզ օգնեց նոր գաղափարներ և նոր գիտելիք ստանալու հարցում։ Իսկ եթե ունես այնպիսի լուծման եղանակ, որը այստեղ նշված չէ, շատ ուրախ կլինեմ, &lt;a href="https://t.me/Beardman1104" rel="noopener noreferrer"&gt;եթե քո տարբերակը ուղարկես ինձ&lt;/a&gt;, այդպիսով փորձի փոխանակում կանենք։&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Զանգվածից դուպլիկատներ հեռացնելու ալգորիթմներ</title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Sun, 14 Nov 2021 17:33:56 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/zangvatsits-dowplikatner-herhatsnelow-algoritmner-1gpk</link>
      <guid>https://dev.to/arsenmazmanyan1104/zangvatsits-dowplikatner-herhatsnelow-algoritmner-1gpk</guid>
      <description>&lt;h2&gt;
  
  
  Բարև սիրելի ծրագրավորող (կամ ապագա ծրագրավորող)։
&lt;/h2&gt;

&lt;p&gt;Այսօր կնայենք հարցազրույցների ժամանակ ամենատարածված խնդիրներից մեկը՝ տառերի զանգվածի միջից դուպլիկատների հեռացման խնդիրը և այդ խնդրի լուծման եղանակներից մի քանիսը։&lt;/p&gt;

&lt;p&gt;Սակայն մինչև առաջ անցնելը 2 կարևոր բան&lt;br&gt;
֊ Խնդիրների լուծումները կլինեն JavaScript լեզվով&lt;br&gt;
֊ Ես ներկայացնում եմ խնդիրը լուծելու գաղափարները և չեմ բացատրելու, թե որ ֆունկցիան իրենից ինչ է ներկայացնում, սակայն կտեղադրեմ համապատասխան հղումները, որպեսզի դու ինքդ ուսումնասիրես&lt;/p&gt;

&lt;p&gt;Եթե սիրում ես խնդիրներ լուծել, ուրեմն արդեն լուծել ես այսպիսի խնդիր։ Կամ հարցազրույցի ժամանակ առընչվել ես այսպիսի խնդրի։&lt;/p&gt;

&lt;p&gt;Բայց մինչև լուծման եղանակներին անցնելը, հասկանանք խնդիրը։&lt;br&gt;
Մենք ստանալու ենք կամայական տառերի զանգված։ Որոշ տառեր կարող են կրկնվել։ Մեր խնդիրն է այնպես անել, որ ամեն տառից մնա 1 հատ։&lt;br&gt;
Այսինքն եթե ստացել ենք ['a', 'a', 'b', 'c', 'd', 'a', 'b', 'a', 'y', 'y'] զանգվածը, պետք է վերադարձնենեք 'a', 'b', 'c',  'd', 'y' տառերը պարունակող զանգված (հերթականությունը էական չէ)։&lt;/p&gt;

&lt;p&gt;Խնդիրը հասկացանք, հիմա անցնենք լուծման եղանակներին&lt;/p&gt;

&lt;h3&gt;
  
  
  Եղանակ 1
&lt;/h3&gt;

&lt;p&gt;Առաջին եղանակը, որը կներկայացնեմ այն է, որ վերցնում ենք զանգվածի առաջին էլեմենտը և ստուգում, արդյո՞ք զանգվածում գոյություն ունի նույն էլեմենտից թե ոչ։ Եթե գոյություն ունի, ապա հեռացնում ենք գտած էլեմենտը, եթե ոչ, անցնում ենք առաջ։ &lt;/p&gt;

&lt;p&gt;Կոդը կունենա այսպիսի տեսք։&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w3xbhn43pfm4gjzbtmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w3xbhn43pfm4gjzbtmw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Վերցնում ենք առաջին էլեմենտը և այն ստուգում ենք զանգվածում իրենից հետո գտնվող մնացած էլեմենտների հետ և եթե նույն տարրից էլի կա, ապա գտածը հեռացնում ենք զանգվածից &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/splice" rel="noopener noreferrer"&gt;Array.splice()&lt;/a&gt; մեթոդի օգնությամբ։ Այստեղ պետք է մեր 2րդ ինդեքսը (j-ն) 1ով փոքրեցնենք, քանի որ զանգվածից 1 էլեմենտ հեռացնելուց հետո նշված ինդեքսից հետո գտնվող էլեմենտները վերադասավորվում են և բոլորի ինդեքսները 1ով փոքրանում են։ Այս գործողությունը անում ենք զանգվածի բոլոր էլեմենտների հետ։&lt;/p&gt;

&lt;p&gt;Լուծման այս եղանակը մեր խնդրին բավարարում է։ Այն համապատասխանում է ES5֊ի ստանդարտներին։&lt;/p&gt;

&lt;p&gt;Բայց արի այսքանով չսահմանափակվենք և դիտարկենք այլ տարբերակներ։&lt;/p&gt;

&lt;h3&gt;
  
  
  Եղանակ 2
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8uqpn5dzp5d5e6pu644d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8uqpn5dzp5d5e6pu644d.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Լուծման այս եղանակում կօգտագործենք &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" rel="noopener noreferrer"&gt;forEach()&lt;/a&gt; և &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf" rel="noopener noreferrer"&gt;indexOf()&lt;/a&gt; մեթոդները, որպեսզի տեսնենք, արդյո՞ք նույն էլեմենտի էլի է հանդիպում զանգավծի մեջ թե ոչ։ Եթե ոչ, այն ավելացնում ենք մեր outputArr֊ի մեջ։&lt;/p&gt;

&lt;h3&gt;
  
  
  Եղանակ 3
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33l13dlj7t1fgd276r7z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33l13dlj7t1fgd276r7z.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Նախորդ եղանակը կարող ենք մի քիչ այլ ձևով իրականացնել։ Մեզ տրված զանգվածի մեջ դուպլիկատներ փնտրելու փոխարեն կարող ենք ստուգել, արդյո՞ք մեր outputArr֊ի մեջ արդեն կա այդ էլեմենտը թե ոչ։ Եթե չկա, ապա ավելացնում ենք։ Այս դեպքում, եթե զանգվածի մեջ դուպլիկատներ կան, ապա ավելի քիչ քայլ ենք անում, քան նախորդ դեպքում։&lt;/p&gt;

&lt;h3&gt;
  
  
  Եղանակ 4
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexlrcm9527bma9pzdwee.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexlrcm9527bma9pzdwee.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Հիմա նայենք մեկ այլ լուծման եղանակի, որտեղ օգտագործվում է &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce" rel="noopener noreferrer"&gt;reduce&lt;/a&gt; մեթոդը։ Այս եղանակում ամեն տարրի համար ստուգում ենք, արդյո՞ք իրեն նախորդող տարրերի ենթաբազմությունում  պարունակվում է իրեն հաջորդող տարրը թե ոչ։ Եթե ոչ, ապա ավելացնում ենք ստուգված էլեմենտը։ Սակայն այս դեպքում մենք ստանում ենք &lt;em&gt;string&lt;/em&gt; տիպին համապատասխանող արժեք, որը կարող ենք զանգված դարձնել &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/String/split" rel="noopener noreferrer"&gt;split()&lt;/a&gt; մեթոդի օգնությամբ։&lt;/p&gt;

&lt;h3&gt;
  
  
  Եղանակ 5
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfn6n0zu0eeuqgyqfd34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyfn6n0zu0eeuqgyqfd34.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Իսկ հիմա քեզ ներկայացնեմ իմ ամենասիրած տարբերակը։ ES6-ում մենք ունենք Set օբյեկտը, որը իր մեջ պահում է միայն չկրկնվող էլեմենտներ։ Սակայն այն զանգված չի համարվում։ Սակայն մենք կարող ենք &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Set" rel="noopener noreferrer"&gt;Set֊ի&lt;/a&gt; արժեքներից զանգված ստանալ &lt;a href="https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Array/from" rel="noopener noreferrer"&gt;Array.from()&lt;/a&gt; մեթոդի շնորհիվ։&lt;/p&gt;

&lt;p&gt;Հույս ունեմ, այս նյութը քեզ օգնեց նոր գաղափարներ և նոր գիտելիք ստանալու հարցում։ Իսկ եթե ունես այնպիսի լուծման եղանակ, որը այստեղ նշված չէ, &lt;a href="https://t.me/Beardman1104" rel="noopener noreferrer"&gt;կարող ես ուղարկել ինձ&lt;/a&gt;, այդպիսով փորձի փոխանակում կանենք։ &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>I'm not a Robot</title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Sun, 01 Aug 2021 19:39:38 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/i-m-not-a-robot-33l9</link>
      <guid>https://dev.to/arsenmazmanyan1104/i-m-not-a-robot-33l9</guid>
      <description>&lt;p&gt;If you're an active internet user then you've probably been accused of being a robot, at least once. It's known as &lt;strong&gt;CAPTCHA&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;In this article, you'll learn about Captcha, what it is, why it is used and why it keeps changing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Captcha&lt;/strong&gt; was created in 2000 and stands for &lt;em&gt;Completely Automatic Public Turing Test to Tell Computers and Humans Apart&lt;/em&gt;. Baiscally, it is a program that protects websites against bots by generating and grading tests that humans can pass but current computer programs cannot. &lt;/p&gt;

&lt;p&gt;Captchas are being used for&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;protecting website registration&lt;/li&gt;
&lt;li&gt;protecting online polls by stopping robots to send in repeated responses&lt;/li&gt;
&lt;li&gt;stopping brute force attacks (where hackers/bots repeatedly try to log in using different passwords)&lt;/li&gt;
&lt;li&gt;preventing users/hackers from signing up for multiple email accounts&lt;/li&gt;
&lt;li&gt;stopping content spamming&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's talk about its history and development.&lt;/p&gt;

&lt;p&gt;Back in 1990's people could write programs to sign up for millions of accounts. Those people were called &lt;em&gt;spammers&lt;/em&gt; . Of course, tech companies needed a way to stop that. And that was one of the  &lt;em&gt;10 Hardest Problems Yahoo Don't Know How To Solve&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Luis von Ahnwas (who is also co-founder and CEO of DuoLingo) was part of the CAPTCHA team. The team figured out that they need a test, which humans could pass, regardless of their age, education, etc. &lt;/p&gt;

&lt;p&gt;In the main version of &lt;strong&gt;Captcha&lt;/strong&gt; we were asked to read and type a &lt;em&gt;distorted word&lt;/em&gt; from an image (things that humans could do but computers couldn't at that time).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--viBCWB4_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d04x0gkyvpctnzgsa020.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--viBCWB4_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d04x0gkyvpctnzgsa020.jpeg" alt="captcha"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But computers also had to be able to grade it. The solution was to put the right answer with the image into the database.&lt;/p&gt;

&lt;p&gt;In 2005 a new version was released, called &lt;strong&gt;ReCaptcha&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--svh5IoXS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hxb4jrb1axf3s3f3cg9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--svh5IoXS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hxb4jrb1axf3s3f3cg9.png" alt="recaptcha"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This one used &lt;strong&gt;2 words&lt;/strong&gt; - the first one was a &lt;em&gt;distorted text&lt;/em&gt; for which the computer had the right answer.&lt;br&gt;
The second word was &lt;em&gt;an image of a word from a book or an article&lt;/em&gt;. The computer didn't have the answer for the second word but if the user got the first word right, the computer assumed, that the second word is right as well and stored the data. The same image was used multiple times on different users and the most common answer was usually used as a right answer. &lt;/p&gt;

&lt;p&gt;This all served as data, which helped computers to get smarter, smart enough to recognize letters and words from new images. &lt;em&gt;In other words, we taught computers to read warped texts&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;2014 Google computer learning study states, that a human could read most distorted CAPTHCAs with 33% accuracy. Meanwhile, their AI could do the same with ..... 99.8% accuracy. It's impressing, how we taught them to do something better than us, isn't it?&lt;/p&gt;

&lt;p&gt;Since computers could do that better than humans, it was а time for а change.&lt;/p&gt;

&lt;p&gt;The new version of ReCaptcha, ReCaptcha V2 was introduced in 2014, which featured images instead of distorted texts. The purpose is the same - to differentiate humans and computers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ty471mHF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d62xz8oq34mi3jnlndq7.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ty471mHF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d62xz8oq34mi3jnlndq7.jpeg" alt="recaptcha v3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And we are still helping computers to get smarter.&lt;/p&gt;

&lt;p&gt;Most of the time we have to select cars, crossroads, and traffic lights from images. Google uses this data to improve its &lt;em&gt;self-driving cars&lt;/em&gt;, so they can see those objects. Data is also used for improving &lt;em&gt;Google Maps&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;But as before, during the time computers become smarter and they can recognize items better than humans and the time for changes came again and this time &lt;strong&gt;ReCaptcha V3&lt;/strong&gt; was introduced.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f_m69wMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5v38vzbdp52x34atyqm1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f_m69wMM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5v38vzbdp52x34atyqm1.jpeg" alt="recaptcha v3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is not much that can be said for this one because it's &lt;em&gt;a guarded secret&lt;/em&gt;. All we know is that &lt;em&gt;our actions are being tracked&lt;/em&gt; from the minute we enter a website, which is using &lt;strong&gt;ReCaptcha V3&lt;/strong&gt;. And by the time we click the &lt;strong&gt;submit&lt;/strong&gt; button, we have already gotten our &lt;em&gt;human badge&lt;/em&gt; (well, at least most of us, haha) and we don't need to find items from images. &lt;/p&gt;

&lt;p&gt;Websites, that use &lt;strong&gt;ReCaptcha V3&lt;/strong&gt; have their benefits (more protected, clean from bots, etc) but we have to sacrifice our privacy to stay safe from bots and scams. Whether you want it or not, you are being tracked 90% of the time.&lt;/p&gt;

</description>
      <category>security</category>
      <category>captcha</category>
      <category>recaptcha</category>
      <category>websites</category>
    </item>
    <item>
      <title>JavaScript in Game Development</title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Mon, 14 Jun 2021 07:22:51 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/javascript-in-game-development-3d9l</link>
      <guid>https://dev.to/arsenmazmanyan1104/javascript-in-game-development-3d9l</guid>
      <description>&lt;p&gt;When I meet someone and they ask what I do for job I tell them, that I'm a &lt;strong&gt;game developer&lt;/strong&gt;. And here what happens. Either they think that I'm using &lt;em&gt;C#&lt;/em&gt; and &lt;em&gt;Unity&lt;/em&gt; &lt;sup&gt;[1]&lt;/sup&gt; or they ask which technology/language I use. And when I tell them I'm using &lt;strong&gt;JavaScript&lt;/strong&gt; for game development, they get confused, because lots of people think that JavaScript is used only for &lt;strong&gt;Front-end&lt;/strong&gt; &lt;em&gt;(React, Vue, Angular, ...)&lt;/em&gt; and &lt;strong&gt;Back-end&lt;/strong&gt; &lt;em&gt;(Node.js)&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;That's what pushed me into writing this article.&lt;/p&gt;

&lt;p&gt;(Before you go ahead, I would like to inform you, that there will be nothing connected with code.)&lt;/p&gt;

&lt;p&gt;Let's start with the definition of Game Development. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Game Development&lt;/strong&gt; is the &lt;em&gt;art&lt;/em&gt; of creating games and describes the design, development, and release of a game (We can call ourselves artists, isn't it interesting?).&lt;/p&gt;

&lt;p&gt;Many game developers choose to develop games using different game engines, such as &lt;em&gt;Unity, Unreal Engine, Gamemaker studio, Godot&lt;/em&gt;, etc. And the common languages for game development are &lt;em&gt;C#, C++, Java, Python, Lua&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;But only a few people know that you can make games using JS.&lt;/p&gt;

&lt;p&gt;There are 2 main ways of making games with JS. &lt;br&gt;
You can manipulate with DOM elements or you can use Canvas or WebGL. &lt;/p&gt;

&lt;p&gt;As for me, making games with DOM elements is more of &lt;strong&gt;Web Development&lt;/strong&gt;, and making games with Canvas/WebGL is more of &lt;strong&gt;Game Development&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Some of you may have heard of &lt;strong&gt;Canvas&lt;/strong&gt; as an HTML5 element, but not about WebGL.&lt;/p&gt;

&lt;p&gt;Let's go ahead and see what they are and what are their main differences.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp58xgikatnh42hit32h6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp58xgikatnh42hit32h6.png" alt="canvas vs webgl wallpaper"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;canvas&lt;/strong&gt; element is part of &lt;strong&gt;HTML5&lt;/strong&gt; and allows for dynamic, scriptable rendering of 2D and 3D shapes and bitmap images. It is a low level, procedural model that updates a bitmap and does not have a built-in scene graph. It provides an empty graphic zone on which specific JavaScript APIs can draw.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Canvas API&lt;/strong&gt; provides a means for drawing graphics using JS and the &lt;strong&gt;HTML canvas&lt;/strong&gt; element. It can be used for animation, game graphics, data visualization, etc. Mainly focuses on &lt;em&gt;2D graphics&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WebGL&lt;/strong&gt; is a JS API for rendering high-performance interactive &lt;em&gt;3D and 2D graphics&lt;/em&gt; within any compatible browser, without the use of plug-ins. WebGL does so by introducing an API that closely conforms to OpenGL ES 2.0 &lt;em&gt;(cross-language, cross-platform Application Programming Interface)&lt;/em&gt; that can be used in &lt;strong&gt;HTML5 canvas&lt;/strong&gt; elements. This conformance makes it possible for the API to take advantage of hardware graphics acceleration provided by the user's device.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fev9sxdo47hq3n8oy45d3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fev9sxdo47hq3n8oy45d3.png" alt="canvas vs webgl comparison table"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since both are JavaScript API’s, there will be similarities to some extent, especially if we talk about bindings and framework development.&lt;/p&gt;

&lt;p&gt;WebGL and Canvas are HTML5 goodies. If a device supports WebGL, then it will automatically support Canvas, but nor Vice Versa&lt;sup&gt;[2]&lt;/sup&gt;. The native 3D API for WebGL is faster and has more capabilities like rendering pipelines, code accessibility, and faster execution. &lt;/p&gt;

&lt;p&gt;Now you know what we need to use to make JS games. Let's go ahead and talk about what will help us to make games.&lt;/p&gt;

&lt;p&gt;We can use either &lt;strong&gt;Game Engine&lt;/strong&gt; or &lt;strong&gt;Game Framework&lt;/strong&gt; to make games. &lt;em&gt;(You can read about their differences &lt;a href="https://dev.to/birdman/game-engines-vs-game-frameworks-1icc"&gt;in this article&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some of the famous JavaScript Game Frameworks  are &lt;br&gt;
&lt;a href="https://phaser.io/" rel="noopener noreferrer"&gt;Phaser&lt;/a&gt;, &lt;a href="https://www.pixijs.com/" rel="noopener noreferrer"&gt;Pixi.js&lt;/a&gt;, &lt;a href="https://threejs.org/" rel="noopener noreferrer"&gt;Three.js&lt;/a&gt;&lt;sup&gt;[3]&lt;/sup&gt;, &lt;a href="https://www.babylonjs.com/" rel="noopener noreferrer"&gt;BabylonJS&lt;/a&gt;. But these are not the only ones.&lt;/p&gt;

&lt;p&gt;These frameworks have lots of integrated tools, which will help you with your work but they also give you enough freedom, to create something on your own, to make it work the way you want. But you need to do more coding with that.&lt;/p&gt;

&lt;p&gt;They all have their communities and there are many ways to join them, where you can ask your questions, get your answers, etc. &lt;/p&gt;

&lt;p&gt;And last, but not least, they all have their tutorials, examples, and documentations very well organized, and using them you can start your journey in &lt;strong&gt;GameDev&lt;/strong&gt;.&lt;/p&gt;




&lt;br&gt;&lt;br&gt;
&lt;sup id="sup1"&gt;[1]&lt;/sup&gt; Unity supported JavaScript as a scripting language until 2017. It's not being supported since then.&lt;br&gt;&lt;br&gt;
&lt;sup id="sup2"&gt;[2]&lt;/sup&gt; Definition of vice versa - the other way around. With the order changed.&lt;br&gt;&lt;br&gt;
&lt;sup id="sup3"&gt;[3]&lt;/sup&gt; Three.js is often defined as 3D library because it doesn't provide some features that are needed to make games. But it doesn't mean you can't implement them.

</description>
      <category>javascript</category>
      <category>gamedev</category>
      <category>canvas</category>
      <category>webgl</category>
    </item>
    <item>
      <title>Game Engines vs Game Frameworks</title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Fri, 11 Jun 2021 06:16:18 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/game-engines-vs-game-frameworks-1icc</link>
      <guid>https://dev.to/arsenmazmanyan1104/game-engines-vs-game-frameworks-1icc</guid>
      <description>&lt;p&gt;When people talk about &lt;strong&gt;Game Development&lt;/strong&gt;, most of them think about Unity, Unreal Engine, or another famous Game Engine.&lt;/p&gt;

&lt;p&gt;As for new developers, &lt;strong&gt;Game Engines&lt;/strong&gt; are really great, because they are higher level, they include basic pieces to make games (graphics renderers, audio engines, ...). They have Level editors and Scene Graph (data structure, in which game data is stored in). Also, they do most of the 'dirty work' for you and in some cases, you can make a game without writing a single line of code (CopperCube engine). But it's not always a good idea to use a Game Engine for making games. &lt;/p&gt;

&lt;p&gt;There are lots of games, that need their own logic, their own behavior, etc. And developers have 2 main choices. Either force tools to behave the way they need or create their own. (Actually, there is a 3rd option as well - quitting).&lt;/p&gt;

&lt;p&gt;In cases, where they want to make something of their own, customized for themselves, &lt;strong&gt;Game Frameworks&lt;/strong&gt; come in handy. Game Framework is a collection of libraries and tools. Libraries are usually created to solve a single task (such as physics, graphics, tweens, etc.).&lt;/p&gt;

&lt;p&gt;Unlike Game Engines Game Frameworks make you code a lot. But it's a very good idea to use Game Framework if you want to practice coding.&lt;/p&gt;

&lt;p&gt;And if you're experienced enough, you can bring together different tools and libraries (or create your own ones) and make something like Game Engine, from Game Framework.&lt;/p&gt;

&lt;p&gt;Summing up, I will recommend Game Engine if it fits your need. Otherwise, I recommend Game Frameworks, because it will help you with coding practice and eventually will push you into creating something of your own (library, tool, or something like that).&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>frameworks</category>
      <category>engines</category>
      <category>libraries</category>
    </item>
    <item>
      <title>Incognito - The Game of Words </title>
      <dc:creator>Arsen Mazmanyan</dc:creator>
      <pubDate>Wed, 24 Feb 2021 18:05:22 +0000</pubDate>
      <link>https://dev.to/arsenmazmanyan1104/incognito-the-geme-of-words-1pl2</link>
      <guid>https://dev.to/arsenmazmanyan1104/incognito-the-geme-of-words-1pl2</guid>
      <description>&lt;p&gt;I confirm, that the incognito mode on the browsers (well, at least on popular ones) is not what most of the people think it is. They still take a lot of data and we are not anonymous there.&lt;br&gt;
But let's keep in order.&lt;/p&gt;

&lt;p&gt;Most of us know about the incognito mode and most of us have used it at least once in our lives. I know only 4 browsers, that don't have incognito mode, but I'll talk about that later.&lt;/p&gt;

&lt;p&gt;First of all let's check, how incognito is defined in Merriam-Webster (US most trusted online dictionary for English). It says "with one's identity concealed (adj.)".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eTD488Ih--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9ygsww15w6s3ytoia7n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eTD488Ih--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9ygsww15w6s3ytoia7n.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Wikipedia incognito mode is defined as 'When operating in such a mode, the browser creates a temporary session that is isolated from the browser's main session and user data'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vy7k20cT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/povmwgeaoh6sg02pemod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vy7k20cT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/povmwgeaoh6sg02pemod.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything seems fine so far. No lies. BUT&lt;/p&gt;

&lt;p&gt;Researchers who cooperated with the University of Chicago and the Leibniz University of Hanover published the results of a study that included 450 participants. The topic was thoughts on 'Incognito mode' or 'Private mode'. According to the study&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“46.5% of participants ‘believed bookmarks saved in private mode would not persist in later sessions,’ when they actually do.&lt;/li&gt;
&lt;li&gt;“40.2% of participants thought websites would not be able to estimate a user’s location,” while in private mode. You can make it harder to estimate your location if you use a VPN.&lt;/li&gt;
&lt;li&gt;“27.1% of participants believed private mode offered more protection against viruses and malware than standard [mode.]” This is a misconception since any files you download and open on your computer could still be infected with malware or viruses.&lt;/li&gt;
&lt;li&gt;“22.0%, 37.0%, and 22.6% of participants mistakenly believed that ISPs, employers, and the government would be unable to track them when they used private mode.” If you’re on someone’s network, chances are they can see what you’re doing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;( &lt;a href="https://www.cnbc.com/2018/07/12/private-web-browsing-not-as-private-as-you-think-research.html"&gt;https://www.cnbc.com/2018/07/12/private-web-browsing-not-as-private-as-you-think-research.html&lt;/a&gt; ) &lt;/p&gt;

&lt;p&gt;I personally find the problem in the definition of the word. We can say that some people still don't have enough knowledge and they expect way more than the usual 'Incognito mode' can provide. But we can also say 'Everybody lies', which we can see by reading the texts on 'Incognito mode' blank tabs. We can clearly see, that they are still far away from being real incognito.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A2m0DLCe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rxbu8yvoddlak7i3bwp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A2m0DLCe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rxbu8yvoddlak7i3bwp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pQLqwvzg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9badniajpsmp7q68z41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pQLqwvzg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9badniajpsmp7q68z41.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to DuckDuckGo, escaping the so-called ‘filter bubble’ of personalized online searches is a perniciously hard problem for the put upon Internet consumer who just wants to carve out a little unbiased space online, free from the suggestive taint of algorithmic fingers.&lt;/p&gt;

&lt;p&gt;I won't go too deep into that, but if you're interested, here is the article (&lt;a href="https://spreadprivacy.com/google-filter-bubble-study/"&gt;https://spreadprivacy.com/google-filter-bubble-study/&lt;/a&gt;). There they explain why they think so.&lt;/p&gt;

&lt;p&gt;At the end, we can say that 'Incognito mode' is not what most of the people think it is. It still shows our activities to websites we visit, our internet providers (well, I hope only they get the info).&lt;/p&gt;

&lt;p&gt;Wish you all a good day, have fun and be careful with your search history.&lt;/p&gt;

</description>
      <category>privacy</category>
      <category>incognito</category>
      <category>browsers</category>
      <category>search</category>
    </item>
  </channel>
</rss>
