<?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 Nihad on Medium]]></title>
        <description><![CDATA[Stories by Nihad on Medium]]></description>
        <link>https://medium.com/@lacrimosaz?source=rss-2240cc6984aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rAN3-Owp0EwuQ61UTk4NCg.jpeg</url>
            <title>Stories by Nihad on Medium</title>
            <link>https://medium.com/@lacrimosaz?source=rss-2240cc6984aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:54:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lacrimosaz/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[What is Pandas? || Intoduction about Pandas. Part 1]]></title>
            <link>https://medium.com/star-gazers/what-is-pandas-intoduction-about-pandas-part-1-bd6bb43a213c?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd6bb43a213c</guid>
            <category><![CDATA[numpy]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Sat, 20 Aug 2022 20:08:37 GMT</pubDate>
            <atom:updated>2022-08-20T20:08:37.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Z3eJ4AeTrQsOzjP3U_-xRw.jpeg" /></figure><blockquote><strong>What is Pandas?</strong></blockquote><p>Pandas is a Python library used for working with data sets. It allows us to analyze data and make conclusion. Pandas can clean messy data sets, and make them readable and relevant.</p><blockquote><strong>How to download Pandas?</strong></blockquote><p>If you use Anaconda, you must open Anaconda terminal and write the code given below:</p><p><strong><em>conda install pandas</em></strong></p><p>Pandas can be installed via pip from PyPi:</p><p><strong><em>pip install pandas</em></strong></p><p>Pandas support the integration with many file formats or data sources out of the box(csv, excel, sql, json, …). Importing data from each of these data sources is provided by functions with the prefix read_. Similarly, the to_ methods are used to store data</p><blockquote><strong>Import pandas to your project:</strong></blockquote><pre><strong><em>import pandas as pd</em></strong></pre><pre><strong><em>import numpy as np</em></strong></pre><pre><strong><em>from numpy.random import randn</em></strong></pre><p><strong>Object Creation:</strong> Creating a series by passing a list of values, letting pandas create a default integer index:</p><pre><strong><em>s = pd.Series([1, 2, 3, 4, 5, np.nan, 7, 8])</em></strong></pre><pre><strong><em>s</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*xolNTH1zwqo2KH2l_G7bew.png" /></figure><pre><strong><em>date = pd.date_range(‘20220820’, periods = 6)<br>date</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*C-F0394KPsF2aBpjuuzS4Q.png" /></figure><pre><strong><em>dataframe = pd.DataFrame(randn(6, 4), index = date, columns = [‘A’,’B’,’C’,’D’])<br>dataframe</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*Zx-KN8bMfycVpaWDihFwyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*FvNARrg8hWVqrevGVms92w.png" /><figcaption>Instuction of <strong>DataFrame</strong></figcaption></figure><p><strong>Note: </strong>DataFrame datatype is the object, not looking at the fact that each element is in separate datatype</p><blockquote><strong>Viewing Data</strong></blockquote><p>View the top and the buttom rows of the frame:</p><blockquote><strong>head()</strong></blockquote><p>This function returns the first `n` rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it. For negative values of `n`, this function returns all rows except the last `n` rows</p><pre><strong><em>dataframe.head()</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*8eHghy0LJciWIRI7TMGfGQ.png" /></figure><pre><strong><em>dataframe.head(3)</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*h14SDNL6vY6RqlqTy4xzXQ.png" /></figure><pre><strong><em>dataframe.head(-2)</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*6-Za3ZhMC6GckGJdqGYDuw.png" /></figure><blockquote><strong>tail()</strong></blockquote><p>This function returns last `n` rows from the object based on position. It is useful for quickly verifying data, for example, after sorting or appending rows. For negative values of `n`, this function returns all rows except the first `n` rows</p><pre><strong><em>dataframe.tail(3)</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*3hUuqFqnGqdyowSljNj2RQ.png" /></figure><pre><strong><em>dataframe.tail(-2)</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*7fIMdnKA2AcVq8Pq4gHEWA.png" /></figure><blockquote><strong>to_numpy()</strong></blockquote><p>Dataframe.to_numpy() gives a Numpy representation of the underlying data. This can be expensive operation when your Datafrane has columns with the different data types.</p><p><strong>Note: Dataframe.to_numpy() does not include the index or column labels in the output.</strong></p><p><strong>dataframe.to_numpy()</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*lYR1GwWW-dOm8gYkkay0nQ.png" /></figure><p>Parameters<br> — — — — — <br><strong>dtype</strong> : str or numpy.dtype, optional. || The dtype to pass to :meth:`numpy.asarray`.<br><strong>copy</strong> : bool, default False. || Whether to ensure that the returned value is not a view on another array. Note that ``copy=False`` does not *ensure* that ``to_numpy()`` is no-copy. Rather, ``copy=True`` ensure that a copy is made, even if not strictly necessary.<br><strong>na_value</strong> : Any, optional. The value to use for missing values. The default value depends on `dtype` and the dtypes of the DataFrame columns.</p><blockquote><strong>describe()</strong></blockquote><p>If you want to see your data with some statistic summary you must use this method</p><p><strong>dataframe.describe()</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*vSWq-8ywhGuRfn_BOg7fyw.png" /></figure><blockquote><strong>For transposing your data</strong></blockquote><p><strong>dataframe.T</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*S3JkMs1vx83Sauf4skCZUg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd6bb43a213c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/star-gazers/what-is-pandas-intoduction-about-pandas-part-1-bd6bb43a213c">What is Pandas? || Intoduction about Pandas. Part 1</a> was originally published in <a href="https://medium.com/star-gazers">Star Gazers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arithmetic and Math Methods in JavaScript.]]></title>
            <link>https://medium.com/star-gazers/arithmetic-and-math-methods-in-javascript-895604736aed?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/895604736aed</guid>
            <category><![CDATA[js]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[math]]></category>
            <category><![CDATA[methods]]></category>
            <category><![CDATA[script]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Thu, 11 Feb 2021 08:28:25 GMT</pubDate>
            <atom:updated>2021-02-11T08:28:25.342Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*FaF9SN3EmbvO60HRlXPvQw.png" /></figure><blockquote><em>If you haven’t read the first part, click </em><a href="https://medium.com/star-gazers/arithmetic-and-math-methods-in-javascript-6d25ea79a6d2"><strong><em>here</em></strong></a><strong><em>.</em></strong></blockquote><p><strong>Math.ceil() Method</strong></p><p>The <strong>Math.ceil()</strong> function always rounds a number up to the next largest integer.</p><p><strong>Example 1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Sc03rcRthKKEop00jh9VQ.png" /></figure><p>Output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HWIOqWIGDlK_uSshBAdFFw.png" /></figure><p>Example 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sXEWu7qrA4HdGcY7b5rtFg.png" /></figure><p>Output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SX8KtCkLv28lVVCXBfd3uA.png" /></figure><p><strong>Math.floor() Method.</strong></p><p>The <strong>Math.floor()</strong> function returns the largest integer less than or equal to a given number.</p><p><strong>Example 1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-FjvXqcF66_iEoair3uHeg.png" /></figure><p>Output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hBof10vE1tlkxuNF7Y4-aA.png" /></figure><p><strong>Example 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n8tMtCDJgDiirljgOADHaA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3iwWg-_wY103oD6fFg23UA.png" /></figure><p><strong>Math.sqrt() Method</strong></p><p>The <strong>Math.sqrt()</strong> function returns the square root of a number. If the value of x is negative, Math.sqrt() returns NaN. Because sqrt() is a static method of Math, you always use it as Math.sqrt(), rather than as a method of a Math object you created (Math is not a constructor).</p><p><strong>Example 1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MN_WwKHOHNDndEZ2g7Z1kg.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*veR1xkJsmx8RWoxxdys3zw.png" /></figure><p><strong>Example 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4a389jI1aIbCXfb7IR450A.png" /></figure><p>Our output is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ez4-p_CmTVT9GzthIlC1aQ.png" /></figure><p><strong>Math.abs() Method.</strong></p><p>The <strong>Math.abs()</strong> function returns the absolute value of a number. Because abs() is a static method of Math, you always use it as Math.abs(), rather than as a method of a Math object you created (Math is not a constructor).</p><p><strong>Example 1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6ZxKLxOv4fP70UE0zjTXQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8kIpWs4jHRlL_OYaNtPS6w.png" /></figure><p><strong>Example 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mpejqr1eGRt1ua89hmq6Pg.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PhaYBpJn4hOFTEmqOWBJpQ.png" /></figure><p><strong>Math.pow( ) Method.</strong></p><p>The <strong>Math.pow()</strong> function returns the base to the exponent power, that is, baseexponent. The <strong>Math.pow()</strong> function returns the base to the exponent power, that is, baseexponent, the base and the exponent are in decimal numeral system. Because pow() is a static method of Math, you always use it as Math.pow(), rather than as a method of a Math object you created (Math has no constructor). If the base is negative and the exponent is not an integer, the result is NaN.</p><p><strong>Example 1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qs8F-zTZrJ8C55zDFymWHA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ujw_dFWlAdGLykFZpZq1w.png" /></figure><p><strong>Example 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FT8fyi8p7YsLzALS5lz9vA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*reiGjqT9HiF_Pu3fUjXxYw.png" /></figure><p><strong>Example 3.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ex0iLqfv-MYD1sX9bxCLzw.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-15I3Tqua1U2rjZJWHLb0g.png" /></figure><p><strong>Math.max() Method.</strong></p><p>The <strong>Math.max()</strong> function returns the largest of the zero or more numbers given as input parameters, or NaN if any parameter isn&#39;t a number and can&#39;t be converted into one. Because max() is a static method of Math, you always use it as Math.max(), rather than as a method of a Math object you created (Math is not a constructor). If no arguments are given, the result is -Infinity. If at least one of arguments cannot be converted to a number, the result is <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN">NaN</a>.</p><p><strong>Example 1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYDBFgvdBr_jE-JNBqLxhQ.png" /></figure><p>Output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0OVcMNHeAzPUwksf0Q4Dw.png" /></figure><p>Array.reduce() can be used to find the maximum element in a numeric array, by comparing each value</p><p><strong>Example 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pszGzB6VXIfEsN-KFCP5og.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P2ljfEjmto5orAop7pccsw.png" /></figure><p><strong>Math.min() Method.</strong></p><p>The static function <strong>Math.min()</strong> returns the lowest-valued number passed into it, or NaN if any parameter isn&#39;t a number and can&#39;t be converted into one. Because min() is a static method of Math, you always use it as Math.min(), rather than as a method of a Math object you created (Math is not a constructor). If no arguments are given, the result is Infinity. If at least one of arguments cannot be converted to a number, the result is NaN.</p><p><strong>Example 1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hRLB_QzZqHD5uXnzN-aOow.png" /></figure><p>Output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JGilPrGTUc4YxKzOsAPR6g.png" /></figure><p><strong>Example 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvUzLnmZTYEnryjmCQ-DSA.png" /></figure><p>Output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*89DV_UAHKJHd007h-Jx78g.png" /></figure><p><strong>Math.random() Method.</strong></p><p>The <strong>Math.random()</strong> function returns a floating-point, pseudo-random number in the range 0 to less than 1 (inclusive of 0, but not 1) with approximately uniform distribution over that range, which you can then scale to your desired range. The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user.</p><p><strong>Example .</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZtrxVI7mZnsZUbDQ177SMQ.png" /></figure><p>First run is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z20ULNk4b30z7W9a_2X7Sw.png" /></figure><p>Second run is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hIMcf-nOXMsR83B9kNFcQQ.png" /></figure><p><strong>Math.cbrt() Method.</strong></p><p>The <strong>Math.cbrt()</strong> function returns the cube root of a number. Because cbrt() is a static method of Math, you always use it as Math.cbrt(), rather than as a method of a Math object you created (Math is not a constructor).</p><p><strong>Example.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pEgIfJzeyZ6OdYhXYEXXbw.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LdHReo2B3YCiiJdqFWoaVg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=895604736aed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/star-gazers/arithmetic-and-math-methods-in-javascript-895604736aed">Arithmetic and Math Methods in JavaScript.</a> was originally published in <a href="https://medium.com/star-gazers">Star Gazers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arithmetic and Math Methods in JavaScript]]></title>
            <link>https://medium.com/star-gazers/arithmetic-and-math-methods-in-javascript-6d25ea79a6d2?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d25ea79a6d2</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Fri, 05 Feb 2021 16:26:33 GMT</pubDate>
            <atom:updated>2021-02-05T16:26:33.217Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 1</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*pLAUjaOmR-u8luKTjW-HXA.png" /></figure><p>JavaScript Operators use either value or variable to compute some task. This lesson describes the JavaScript operators with example, and operators precedence.</p><h3>Arithmetic Operators</h3><p>JavaScript arithmetic operator take operand (as a values or variable) and return the single value.</p><h4><strong>+ Operator</strong></h4><p>With this operator, we can add two or more values. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVGMcQx7qKTte48lj0HKEA.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtS4eDOQwcRmVmnYWG25tA.png" /></figure><p>As you know, in JavaScript, a value is not only a number but also a value in string expressions. What will be the result if we want to collect them?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2l76lm5-sYuy3SxO2znGQ.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1H2D3f6SrltOOKNSqpiVGg.png" /></figure><p>And what happens if we add the string value to the numbers? Let’s examine the result using the following code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2yC1_m_MbDG3bVIthDkseQ.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tr9OQksoWCDtLj2WGtuWLg.png" /></figure><p><strong>Also:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kwIozyFuTjvu8GCUeq4o8g.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xW_7f7m7BdjObbHX80ztdw.png" /></figure><h4><strong>- Operator</strong></h4><p>With this operator, we can find the difference of values.</p><p><strong>Example 1:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bAIre1BYiIM6MASi_1fu5A.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-4llVmh34Z5WS2xbQYw3Q.png" /></figure><p><strong>Example 2:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*73vrI80reodC2rMINJOyFQ.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rsj2cy9s91dytT4fWmJmUQ.png" /></figure><p><strong>But we can’t override string values here.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E95v67e6Vuwgn9j-TDRtZg.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iekztHvrzXSaMvnPMt8kWQ.png" /></figure><h4><strong>* Operator</strong></h4><p>The multiplication operator produces the product of the operands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTDYQusKFAfpjVeLclITLw.png" /></figure><p>And out output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qSO8KvwBw1bSHP-hdLPkwQ.png" /></figure><h4><strong>/ Operator</strong></h4><p>The division operator produces the quotient of its operands where the left operand is the dividend and the right operand is the divisor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AB1DojFkR0BHb53OFh7V-Q.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*taGnfIkjC6Wj7kBXd0dorA.png" /></figure><h4><strong>% Operator/Remainder Operator</strong></h4><p>The remainder operator returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KEm0aCgpUq7oA-AScJSVSA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3eginkc4vmgbq3q0VbxT4A.png" /></figure><p><strong>Example 2:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Coj156oELf_dA59q4ZV92Q.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7nilkq6NTNN488EHoBMxw.png" /></figure><h4><strong>++ Operator/</strong><strong>Increment Operator:</strong></h4><p>The increment operator increments adds one to its operand and returns a value. If used postfix, with operator after operand (for example, x++), the increment operator increments and returns the value before incrementing. If used prefix, with operator before operand (for example, ++x), the increment operator increments and returns the value after incrementing.</p><p><strong>Postfix (x++) Increment Operation:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2JqUMON4fOyuvVs9ERnRTg.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTUFkFaAruU0BZ9IoLzuJA.png" /></figure><p><strong>Prefix (++x) Increment Operation:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2lZUFbQvyaRhkAYd_3qlg.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tt2BZE5v7px4JLjKCtWQ-Q.png" /></figure><h4><strong>- - Operator/Decrement Operator:</strong></h4><p>The decrement operator decrements (subtracts one from) its operand and returns a value. If used postfix, with operator after operand (for example,x- -), the decrement operator decrements and returns the value before decrementing. If used prefix, with operator before operand (for example,- -x), the decrement operator decrements and returns the value after decrementing.</p><p><strong>Postfix Decrement (x- -)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PFNIiILBT_Qg-qpm9Pw-7g.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bPQs_wmFEMnYwn1JvqylGg.png" /></figure><p><strong>Prefix Decrement (- -x)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4L6qFfFboapeAFst35cCA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OPnna5I_ObxskYddKs_NPQ.png" /></figure><h3>Math Methods</h3><p><strong>Math</strong> is a built-in object that has properties and methods for mathematical constants and functions. It’s not a function object.</p><h4><strong>Math.Pi</strong></h4><p>The <strong>Math.PI</strong> property represents the ratio of the circumference of a circle to its diameter, approximately 3.14159:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KdSRvAn8loa8uIHhxkIQWQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WoXpO0rZRsvZIXTElRNWjA.png" /></figure><h4><strong>Math.E</strong></h4><p>The <strong>Math.E</strong> property represents Euler&#39;s number, the base of natural logarithms, e, which is approximately 2.718.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FTDzIVZYQTJHTiWObrh76A.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sMUWNJ0XuWk6FE46Lmj5_g.png" /></figure><h4><strong>Math.round()</strong></h4><p>The <strong>Math.round()</strong> function returns the value of a number rounded to the nearest integer. If the fractional portion of the argument is greater than 0.5, the argument is rounded to the integer with the next higher absolute value. If it is less than 0.5, the argument is rounded to the integer with the lower absolute value.</p><p><strong>Example 1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ay7TkQ0Rn_tkXmoOsMg7g.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMgtEz5jkEhV5Eek9DSC1A.png" /></figure><p><strong>Example 2</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HEZAvcQiT4fIzuobNaIVuQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r2khcPX6T3QDccHDIp1yYQ.png" /></figure><h3>Conclusion</h3><p>And there you have it. A basic guide to arithmetic and math functions in JavaScript. We hope you found this useful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d25ea79a6d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/star-gazers/arithmetic-and-math-methods-in-javascript-6d25ea79a6d2">Arithmetic and Math Methods in JavaScript</a> was originally published in <a href="https://medium.com/star-gazers">Star Gazers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A beginner’s guide to Arrays in JavaScript (Part 2)]]></title>
            <link>https://javascript.plainenglish.io/a-beginners-guide-to-arrays-in-javascript-part-2-4fe0665bd2a3?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fe0665bd2a3</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Wed, 27 Jan 2021 15:41:13 GMT</pubDate>
            <atom:updated>2021-01-27T15:41:13.051Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffn_8KUwJzhcDuQP5a4oow.jpeg" /></figure><p><em>If you haven’t read the first part, click</em><a href="https://medium.com/javascript-in-plain-english/array-data-type-and-array-methods-in-javascript-50a29af0c49b"><em> </em><strong><em>here</em></strong></a><em>.</em></p><h4><strong>6. Method of .pop()</strong></h4><p>The pop() method removes the <strong>last</strong> element from an array and returns that element. This method changes the length of the array. Syntax: <strong>arr.pop()</strong>. If you call pop() on an empty array, it returns undefined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy7SfpVScqUOJrAyepJo4A.png" /></figure><p>Our output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-nHxnRirz6n9FcMjPVLskg.png" /></figure><p>If we write the code as you see above, then the last value to be deleted from the Array will be printed on the screen. If you want to print the Array after deleting the last element on the screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmE5TpmkPiJUHowyMUB6GA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d2GJAkcJC9x629GtA9MTVQ.png" /></figure><h4><strong>7. Method of .unshift()</strong></h4><p>The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array. Syntax: arr.unshift(element1[, ...[, elementN]])</p><p>Although this method is similar to the push () method, the only difference is that the value-added to the Array with the .unshift () method replaces the first element of the Array, and the indexes of the other elements move one unit to the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1FdhWe6yCjTsD__Cp4t8Ew.png" /><figcaption>Before adding an element to the Array with the .unshift () method:</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JtRNwXZpHbiGwui4yMoZUw.png" /><figcaption>After adding an element to the Array with the .unshift () method:</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4VizdvTK0TPyg7C7fmqsw.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPoBcSKosg9EO7wq28Mnfw.png" /></figure><p><em>As you can see, if we write the code in this way, it will print the number of elements in the Array after the element is added to the Array. If we want to print the Array itself, then:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ehG8P8X1WdLGhfV6r2JjUQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nQZoRfxPoVwWkrfJlfH8cw.png" /></figure><h4><strong>8. Method of .shift()</strong></h4><p>The shift() method removes the first element from an array and returns that removed element. This method changes the length of the array. Syntax: <strong>arr.shift()</strong></p><p>The shift() method removes the element at the zeroeth index and shifts the values at consecutive indexes down, then returns the removed value. If the length property is 0, undefined is returned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2Cc9HMkQBvkCdNWDdyFGA.png" /><figcaption>before the shift () method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*IsJtmdStlG9k8F8qWrHbcA.png" /><figcaption>after the shift() method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmJZbMo1l1i41fkjiLFyvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRCrkFuLplBW5B7CBCiqIA.png" /></figure><h4><strong>9. Method of .slice()</strong></h4><p>The slice() method returns the selected elements in an array, as a new array object. The slice() method selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.<br><strong>Note: </strong>The original array will not be changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZZgokmuM7052bmUkATOyeQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X1M2QH5bYBgmNBtAAhBaQw.png" /></figure><h4><strong>10. Method of .splice()</strong></h4><p>The splice() method adds/removes items to/from an array, and returns the removed item(s). Syntax:</p><p>let arrDeletedItems = arr.splice(start[, deleteCount[, item1[, item2[, ...]]]])</p><p><strong>start</strong> The index at which to start changing the array.</p><p>If greater than the length of the array, <strong>start</strong> will be set to the length of the array. In this case, no element will be deleted but the method will behave as an adding function, adding as many element as item[n*] provided.</p><p>If negative, it will begin that many elements from the end of the array. (In this case, the origin <strong>-1</strong>, meaning <strong>-n</strong> is the index of the nth last element, and is therefore equivalent to the index of <strong>array.length - n</strong>.) If <strong>array.length + start</strong> is less than <strong>0</strong>, it will begin from index <strong>0</strong>.</p><p><strong>deleteCount</strong> Optional An integer indicating the number of elements in the array to remove from <strong>start</strong>. If <strong>deleteCount</strong> is omitted, or if its value is equal to or larger than <strong>array.length - start</strong> (that is, if it is equal to or greater than the number of elements left in the array, starting at <strong>start</strong>), then all the elements from <strong>start</strong> to the end of the array will be deleted.</p><p>If <strong>deleteCount</strong> is <strong>0</strong> or <strong>negative</strong>, no elements are removed. In this case, you should specify at least one new element.</p><p><strong>item1, item2, ...</strong> Optional The elements to add to the array, beginning from start. If you do not specify any elements, splice() will only remove elements from the array.</p><p><strong>Note:</strong> This method changes the original array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DoMxonupQpfsE9DQLMxmGg.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V-qNXUbcaH064fSlkXJnkA.png" /></figure><h4><strong>11. Method of .reverse()</strong></h4><p>The reverse() method reverses an array in place. The first array element becomes the <strong>last</strong>, and the last array element becomes the <strong>first</strong>. The reverse() method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array. reverse() is intentionally generic; this method can be called or applied to objects resembling arrays. Objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner.</p><p>Syntax: <strong>arr.reverse()</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZ77i4LB25zc96zRQzEviQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kDghRn2XHpgw9dwaRPjkoQ.png" /></figure><h4><strong>12. Method of .concat()</strong></h4><p>The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array. Syntax is: <strong>const new_array = old_array.concat([value1[, value2[, …[, valueN]]]])</strong></p><p>The concat() method creates a new array consisting of the elements in the object on which it is called, followed in order by, for each argument, the elements of that argument (if the argument is an array) or the argument itself (if the argument is not an array). It does not recurse into nested array arguments.</p><p>The concat() method does not alter this or any of the arrays provided as arguments but instead returns a shallow copy that contains copies of the same elements combined from the original arrays. Elements of the original arrays are copied into the new array as follows:</p><ol><li>Object references (and not the actual object): concat copies object references into the new array. Both the original and new array refer to the same object. That is, if a referenced object is modified, the changes are visible to both the new and original arrays. This includes elements of array arguments that are also arrays.</li><li>Data types such as strings, numbers and booleans (not String, Number, and Boolean objects): concat copies the values of strings and numbers into the new array.</li></ol><p><strong>Note: </strong>Concatenating array(s)/value(s) will leave the originals untouched. Furthermore, any operation on the new array (except operations on elements which are object references) will have no effect on the original arrays, and vice versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPLHS88WsE68kadp8kwUXg.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sc8gDlKfSZhry2LJ7rYI5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8_bHB4YpdtcEEn5R55m0rQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3L1t-OAUEK9CoHy2LPHeA.png" /></figure><h4><strong>13. Method of .sort()</strong></h4><p>The sort() method sorts the elements of an array in place and returns the sorted array. The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of<strong> UTF-16</strong> code units values. The time and space complexity of the sort cannot be guaranteed as it depends on the implementation. Syntax:<strong> arr.sort([compareFunction])</strong></p><p>If compareFunction is not supplied, all non-undefined array elements are sorted by converting them to strings and comparing strings in UTF-16 code units order. For example, “banana” comes before “cherry”. In a numeric sort, 9 comes before 80, but because numbers are converted to strings, “80” comes before “9” in the Unicode order. All undefined elements are sorted to the end of the array. If compareFunction is supplied, all non-undefined array elements are sorted according to the return value of the compare function (all undefined elements are sorted to the end of the array, with no call to compareFunction). If a and b are two elements being compared, then:</p><ol><li>If compareFunction(a, b) returns less than 0, sort a to an index lower than b (i.e. a comes first).</li><li>If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements.</li><li>If compareFunction(a, b) returns greater than 0, sort b to an index lower than a (i.e. b comes first).</li><li>compareFunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. If inconsistent results are returned, then the sort order is undefined.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a7MzZFjOS9Rq5X2_ykomxQ.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gnqWYQ4Rs0dP8FHm3zbS5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1fIwMuNi45v7LK9WyCy6g.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oe2QdZE04QyhVgA6fX8N8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LPRMWHaYlA8GLEu3y7SsFw.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSuP6Gei7T7idan7aI-8jw.png" /></figure><h4><strong>14. Method of .find()</strong></h4><p>The find() method returns the value of the first element in the provided array that satisfies the provided testing function. If no values satisfies the testing function, undefined is returned.</p><ol><li>If you need the index of the found element in the array, use findIndex().</li><li>If you need to find the index of a value, use .indexOf(). (It’s similar to findIndex(), but checks each element for equality with the value instead of using a testing function.)</li><li>If you need to find if a value exists in an array, use .includes(). Again, it checks each element for equality with the value instead of using a testing function.</li><li>If you need to find if any element satisfies the provided testing function, use .some().<br>Syntax:<strong> arr.find(callback(element[, index[, array]])[, thisArg])</strong><br><br>The .find() method executes the <strong>callback function</strong> once for each index of the array until the callback returns a truthy value. If so, find immediately returns the value of that element. Otherwise, find returns undefined.<br><br>callback is invoked for every index of the array, not just those with assigned values. This means it may be less efficient for sparse arrays, compared to methods that only visit assigned values.<br><br>If a thisArg parameter is provided to find, it will be used as the this value inside each invocation of the callback. If it is not provided, then undefined is used.<br><br>The .find() method does not mutate the array on which it is called, but the function provided to callback can. If so, the elements processed by find are set before the first invocation of callback. Therefore:</li></ol><p>1) callback will not visit any elements added to the array after the call to find begins.<br> 2) If an existing, yet-unvisited element of the array is changed by callback, its value passed to the callback will be the value at the time find visits that element’s index.<br> 3) Elements that are deleted are still visited.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XuNGIMbYVAM5JRF2-qLYZA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7G0KW8nAl74eX38bXRNnA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fe0665bd2a3" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/a-beginners-guide-to-arrays-in-javascript-part-2-4fe0665bd2a3">A beginner’s guide to Arrays in JavaScript (Part 2)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A beginner’s guide to Arrays in JavaScript]]></title>
            <link>https://javascript.plainenglish.io/array-data-type-and-array-methods-in-javascript-50a29af0c49b?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/50a29af0c49b</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[array-methods]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Wed, 27 Jan 2021 09:20:00 GMT</pubDate>
            <atom:updated>2021-01-27T15:48:57.128Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffn_8KUwJzhcDuQP5a4oow.jpeg" /></figure><p>JavaScript arrays are used to store multiple values in a single variable. An array is a special variable, which can hold more than one value at a time.</p><h3><strong>Creating an Array</strong></h3><h4><strong><em>1. Using an array literal is the easiest way to create a JavaScript Array</em></strong></h4><p>Syntax:</p><p>var array_name = [item1, item2, …];</p><p>Spaces and line breaks are not important. A declaration can span multiple lines:</p><pre>var cities= [<br>  &quot;Moscow&quot;,<br>  &quot;Berlin&quot;,<br>  &quot;München&quot;<br>];</pre><h4><strong><em>2. Using the JavaScript Keyword </em></strong>new</h4><pre>var cities = new Array(&quot;Moscow&quot;, &quot;Berlin&quot;, &quot;München&quot;);</pre><p>The two examples above do exactly the same. There is no need to use new Array() . For simplicity, readability and execution speed, use the first one (the array literal method).</p><h3>Methods of Array</h3><p>The strength of JavaScript arrays lies in the array methods. Array methods are functions built-in to JavaScript that we can apply to our arrays — Each method has a unique function that performs a change or calculation to our array and saves us from writing common functions from scratch.</p><h4><strong>1. Reach the elements of Array</strong></h4><p>As mentioned above, Arrays are a combination of several elements. If we want to print one of these elements:</p><pre>const myArray = [&quot;USA&quot;, &quot;Russia&quot;, &quot;Turkey&quot;, &quot;Israel&quot;];</pre><pre>console.log(myArray);</pre><p>If we “run” the above code, we will see that the whole Array is printed on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*jZuD1YHngOO2MjNyIIaatA.png" /></figure><p>If we want to print any element of the Array on the screen:</p><pre>const myArray = [&quot;USA&quot;, &quot;Russia&quot;, &quot;Turkey&quot;, &quot;Israel&quot;];</pre><pre>console.log(myArray[2]);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*rZO3mAblNuXSl1Al5Ch_MA.png" /></figure><p>For beginners to JavaScript, the question may arise: “After all, our second element in the Array is Russia . Why was Turkey printed on the screen? This is because the elements in the Array are sorted starting from zero indexes. , Continues as 0, 1, 2 ..., not as 1, 2, 3….</p><h4><strong>2. Method of .length()</strong></h4><p>The length() property of an object which is an instance of type Array sets or returns the number of elements in that array. The value is an unsigned, 32-bit integer that is always numerically greater than the highest index in the array. The value of the length() property is an integer with a positive sign and a value less than 2 to the 32nd power (232). You can set the length() property to truncate an array at any time. When you extend an array by changing its length() property, the number of actual elements increases; for example, if you set length to 3 when it is currently 2, the array now contains 3 elements, which causes the third element to be a non-iterable empty slot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nPQK4hoeTQU1yn1MOS53yA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3U1G7kpzBPTbi8QFbbyFvg.png" /></figure><h4><strong>3. Method of Array.isArray()</strong></h4><p>The Array.isArray() method determines whether the passed value is an Array. Syntax: Array.isArray(value) . If the value is an Array, true is returned; otherwise, false is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ydMoo1Gqg5gkevxBDjoFyA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MnkwalaIMMURBGwzWi_Kwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GpkKporfGaFSStdjluc88Q.png" /></figure><p>Our output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cf23usPsCCzeaHJ2jWTD1w.png" /></figure><h4><strong>4. Method of .indexOf()</strong></h4><p>The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present. Syntax: <strong>arr.indexOf(searchElement[, fromIndex])</strong>.</p><p>indexOf() compares searchElement to elements of the Array using strict equality (the same method used by the === or triple-equals operator).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DjfmvtEDtd10h7dlu8TfsA.png" /></figure><p>Our output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H_dmxTioa2r9GVmIWm0Qog.png" /></figure><p><em>As mentioned above, the reason for printing </em><em>Berlin in the 2nd index is that the elements of the array start counting from zero indexes</em>.</p><h4><strong>5. Method of .push()</strong></h4><p>The push() method adds one or more elements to the end of an array and returns the new length of the array. Syntax:</p><p><strong>arr.push([element1[, ...[, elementN]]]). </strong>After using this method, the length, and index of the Array increase by the number of each added element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7SHeBzWWmyks4aRkMdQSA.png" /></figure><p>Our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMgtEz5jkEhV5Eek9DSC1A.png" /></figure><p><em>As you can see, on the screen, the number of elements of the Array is printed. If we want to print the Array itself, we must first add value to the Array and then print it to the screen:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKy6b6iyFgLaYkCNWi1qxA.png" /></figure><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OT4Nc4PpplGPikNjWFHM3Q.png" /></figure><p>Part 2 is here : <a href="https://medium.com/javascript-in-plain-english/a-beginners-guide-to-arrays-in-javascript-part-2-4fe0665bd2a3">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50a29af0c49b" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/array-data-type-and-array-methods-in-javascript-50a29af0c49b">A beginner’s guide to Arrays in JavaScript</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Types and Data Types Converting in JavaScript]]></title>
            <link>https://medium.com/geekculture/data-types-and-data-types-converting-in-javascript-f59dda6928ba?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f59dda6928ba</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Mon, 25 Jan 2021 20:03:29 GMT</pubDate>
            <atom:updated>2021-01-25T20:03:29.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*BXAFvHSqQpTFClU4pHfk3Q.jpeg" /></figure><blockquote><em>Data types specify what kind of data can be stored and manipulated within a program. In JavaScript, data types are divided into two parts. </em><strong>Primitive data types</strong><em> and </em><strong>Reference data types</strong><em>. These data types are subdivided into several types.</em></blockquote><blockquote><em>Primitive data types are </em><strong>string, number, boolean, null, undefined, symbol</strong><em>. As you know, strings are used to express </em><strong><em>texts</em></strong><em>. numbers</em><strong><em> </em></strong><em>are used to denote </em><strong>numbers</strong><em>, booleans are used to denote </em><strong>“true”</strong><em> and </em><strong>“false”</strong><em>, nulls are used to denote that a variable </em><strong>“has no value”</strong><em>, undefined are used to denote </em><strong>indefinite variables</strong><em>, and symbols are used to denote </em><strong>symbols</strong><em>.</em></blockquote><blockquote><em>Reference data types were data types created within the object. These are </em><strong>arrays, objects, functions, dates, etc.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDDCJQGIxxNEB9kJU6e9iQ.jpeg" /></figure><h3>Primitive Data Types.</h3><p><strong>String Data Types.</strong></p><blockquote><em>Strings are written with quotes. You can use single or double quotes. A string (or a text string) is a series of characters. Example:</em></blockquote><pre>const str = &quot;JavaScript&quot;;<br>console.log(typeof str);</pre><p>The algorithm of the above example is as follows. First, we create a variable named <strong><em>“str”</em></strong>. Then we assign the value <strong><em>“JavaScript”</em></strong> to that variable. In the second part, with the <strong><em>“typeof”</em></strong> command, we print the type of our variable, whose name is <em>“str”</em> and whose value is <strong><em>“JavaScript”</em></strong>. If we open the console in our browser, we will see that the string is printed on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*-fsbnl8533Zuidem0T3_WQ.png" /></figure><blockquote><em>As we said, in JavaScript strings are written in quotation marks. Sometimes we want to use a quotation mark inside a quotation mark. But in this case, we face a problem. Our string value cannot be read on the browser side. Let’s explain the problem clearly through the code.</em></blockquote><pre>const str = &quot;JavaScript and &quot;Data Types&quot; &quot;;<br>console.log(str);</pre><p>If we “run” our code, we will encounter an error in our browser console. To avoid this error, Js developers have found a solution as follows.</p><pre>const str = &quot;Javascript and &#39;Data Types&#39; &quot;;<br>console.log(str);</pre><p>Also,</p><pre>const str = &#39;JavaScript and &quot;Data Types&quot; &#39;;<br>console.log(str);</pre><h3>Number Data Types.</h3><blockquote><em>JavaScript has only one type of numbers. Numbers can be written with, or without decimals.</em></blockquote><pre>const nmbr = 20;<br>console.log(typeof nmbr);</pre><p>The algorithm of our code is the same as string data types, and if we <strong><em>“run”</em></strong> our code, we can see that <strong><em>“number”</em></strong> is printed in the console part of our browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*uHS8Xof1TGQdRpk7HvFkZg.png" /></figure><p>Extra-large or extra small numbers can be written with scientific (exponential) notation.</p><pre>const nmbr = 123e5;<br>console.log(nmbr);</pre><p>It is the same as,</p><pre>const nmbr = 12300000;<br>console.log(nmbr);</pre><h3>Boolean Data Types.</h3><blockquote><em>Booleans can only have two values: </em><strong>true</strong><em> or</em><strong> false</strong><em>.</em></blockquote><pre>const bln = true;<br>console.log(typeof bln);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*CSYfj7FmlsUrjZqfkxTgKg.png" /></figure><p>Booleans are often used in conditional testing.</p><pre>const x = 15;<br>const y = 15;<br>console.log(x==y);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*Wi9hL-LM06c-_cg-V8ZoCg.png" /><figcaption>If the result of our operation is correct, it returns true.</figcaption></figure><pre>const x = 15;<br>const y = 14;<br>console.log(x==y);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*s_vxxbHFnLt8kTTaUSslPg.png" /><figcaption>If the result of our operation is incorrect, it returns false.</figcaption></figure><h3>Null Data Types.</h3><blockquote><em>In JavaScript null is </em><strong>“nothing”</strong><em>. It is supposed to be something that doesn’t exist. Unfortunately, in JavaScript, the data type of null is an object. You can consider it a bug in JavaScript that typeof null is an object. It should be null.</em></blockquote><pre>var nll = null;<br>console.log(typeof nll);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*lQFV1R64TpbFFAm9TgMkSA.png" /></figure><h3>Undefined Data Types.</h3><blockquote><em>In JavaScript, a variable without a value, has the value undefined. The type is also undefined.</em></blockquote><pre>var undf;<br>console.log(typeof undf);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*UiWALFE7RpuKfvLRa4GcwQ.png" /></figure><h3>Difference Between Undefined and Null Data Types.</h3><blockquote>Undefined and null are equal in value but different in type.</blockquote><pre>typeof undefined           // undefined<br>typeof null                // object</pre><pre>null === undefined         // false<br>null == undefined          // true</pre><h3>Reference Data Types.</h3><p>Array Data Types.</p><blockquote><em>JavaScript arrays are written with square brackets. Array items are separated by commas. Array indexes are zero-based, which means the first item is [0], second is [1], and so on.</em></blockquote><pre>var programmingLanguage = [&quot;C&quot;, &quot;C++&quot;, &quot;R&quot;];<br>console.log(programmingLanguage);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*5riQx94ESg8MmCcZFtEAQQ.png" /></figure><p>Object and Symbol Data Types.</p><blockquote><em>The symbol type is used to create unique identifiers for objects. We have to mention it here for the sake of completeness, but also postpone the details till we know objects. JavaScript objects are written with curly braces</em><strong> {}</strong><em>. Object properties are written as name:value pairs, separated by commas.</em></blockquote><pre>var person = { firstName: &quot;Mehdi&quot;, lastName: &quot;Huseyn&quot;, age: 111, eyeColor: &quot;blue&quot; };</pre><pre>console.log(person);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*qZVHqGCVBPh7nCvLb5iE0Q.png" /></figure><h4>Function Data Types.</h4><blockquote><em>Functions are one of the fundamental building blocks in JavaScript. A function in JavaScript is similar to a procedure — a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output. To use a function, you must define it somewhere in the scope from which you wish to call it. A function definition (also called a function declaration, or function statement) consists of the function keyword, followed by:<br> 1)The name of the function.<br> 2)A list of parameters to the function, enclosed in parentheses and separated by commas.<br> 3)The JavaScript statements that define the function, enclosed in curly brackets, {…}.<br>For example, the following code defines a simple function named cubic.</em></blockquote><pre>function cubic(number) {<br>    return number * number * number;<br>}<br>console.log(cubic(3));// Output is: 3*3*3=27;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*SWhY6-JOkDsudSvJoHrX6A.png" /></figure><blockquote><em>The function cubic takes one </em><strong>parameter</strong><em>, called </em><strong>number</strong><em>. The function consists of one statement that says to return the parameter of the function (that is, number) multiplied by itself two times. The statement return specifies the value returned by the function.</em></blockquote><h3>Data Types Converting.</h3><p>Number → String</p><pre>var nmbr = 5;<br>console.log(typeof nmbr);<br>nmbr = String(5);<br>console.log(typeof nmbr);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*5ip-y0aat6Oe4Hs9VXyZ9Q.png" /></figure><p>Bool →String</p><pre>let data = false;<br>console.log(typeof data);<br>data  = String(false);<br>console.log(typeof data);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*16qJvIFkdc-eSDmwaBJiZw.png" /></figure><p>Array → String</p><pre>arry = [0, 1, 2, 3];</pre><pre>console.log(typeof arry);</pre><pre>arry = String([0, 1, 2, 3]);</pre><pre>console.log(typeof arry);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*zYw1_HuV1waxiTfwbpm52Q.png" /></figure><p>String → Number</p><pre>var str = &quot;JavaScript&quot;;</pre><pre>console.log(typeof str);</pre><pre>str = Number(&quot;Javascript&quot;);</pre><pre>console.log(typeof str);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*1VVzPeOka8Q-GLHtuSIoyg.png" /></figure><p>Boolean →Number</p><pre>var bln = true;</pre><pre>console.log(typeof bln);</pre><pre>bln = Number(true);</pre><pre>console.log(typeof bln);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*DgktOunj9Xd2KIRhK1GJtg.png" /></figure><p>Null → Number</p><pre>var nll = null;</pre><pre>console.log(typeof nll);</pre><pre>nll = number(nll);</pre><pre>console.log(typeof nll);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*2xclefgBOGTmNNzEr-8Vmg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f59dda6928ba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/data-types-and-data-types-converting-in-javascript-f59dda6928ba">Data Types and Data Types Converting in JavaScript</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the Pi coin?]]></title>
            <link>https://medium.com/star-gazers/what-is-the-pi-coin-7d6ddbded3cb?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d6ddbded3cb</guid>
            <category><![CDATA[pi-coin]]></category>
            <category><![CDATA[pi]]></category>
            <category><![CDATA[pi-network]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[cyrpto-value]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Sun, 17 Jan 2021 10:39:23 GMT</pubDate>
            <atom:updated>2021-01-17T10:39:23.478Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*pudJACE4SvtBqQoU3QK1kw.jpeg" /></figure><blockquote>Pi is a crypto asset created based on the stellar platform. The platform opens to the community during the beta process, and although mining is not normally available on the Stellar platform, it allows the sharing of this digital asset, which is produced by simulating mining with the developments it offers, with a meritocracy-based distribution model. You can earn Pi on the platform with three different roles. Pioneer, Contributor, and Ambassador.</blockquote><blockquote>As with most other mined cryptocurrencies, there is a halving in Pi. The halving trigger is the number of members. Each time the number of current members reaches a new strength of 10 (100000, 1 million, 10 million ….)<br>Mobile miners’ base mining speeds (pioneer + contributor) are halved. Thus, it is predicted that Pi will maintain and increase its value as a rare digital asset over time.</blockquote><blockquote>You can bring new members to your team to earn more Pi. For every new member who starts using the application by typing your Pi user name in the invitation code section during registration, you will gain an additional digging speed of 25% of your foundation excavation speed at all times you dig together.</blockquote><blockquote>From the moment we started the application excavation, it gives us Pi every second in 24-hour periods. When we complete three 24-hour excavation periods, we have the role of the contributor and can establish a safety circle. We can add as many members to the security circle as we want, but we can only benefit from 5 of them. Each member in the circle increases our base excavation speed by 20% (up to 100% + with 5 members).</blockquote><blockquote>Pi aims to produce the world’s most widely used cryptocurrency and to create a large-scale economy with this cryptocurrency through the exchange of products/services within the digital market between members on Pi Platform. Also, this economy will be supported by decentralized applications and home screen paid promotions by members and developers from outside the platform, thanks to smart contract support and application main screen block.</blockquote><blockquote>Over time, all these activities will shape the free market economy and a price formation accepted by Pi’s members. Pi will then be placed on its main blockchain and will be listed on exchanges. Thanks to all this development process, millions of Pi users will have a cryptocurrency (Pi) whose price has been agreed by the masses, which will prevent exchange users who want to own Pi from purchasing Pi below its value.</blockquote><blockquote>In other words, Pi’s success depends on the collective contributions, use, and adoption of the community. It is up to you as a community to generate value with Pi. To benefit from Pi, all members must focus on: how they can contribute to the digital market process, the Pi ecosystem, and the economy through real production or consumption.</blockquote><blockquote>You can think of the Pi network as a digital nation and the Pi we have accumulated as citizenship pension. It is up to us to create an economy with Pi. In the current process, the developer team prepares the infrastructure of the areas where we will use Pi. They develop software that will secure our network and ensure its functionality.</blockquote><blockquote>If you want to register to Pi immediately, you can dig using the <a href="http://minepi.com/Cyclopss1">Cyclopss1 </a>invitation code (reference):</blockquote><blockquote>My reference code: minepi.com/Cyclopss1</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d6ddbded3cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/star-gazers/what-is-the-pi-coin-7d6ddbded3cb">What is the Pi coin?</a> was originally published in <a href="https://medium.com/star-gazers">Star Gazers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How do we make basic image slideshow in JavaScript?]]></title>
            <link>https://medium.com/swlh/how-do-we-make-basic-image-slideshow-in-javascript-c0c661f0db16?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0c661f0db16</guid>
            <category><![CDATA[slideshow]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[image]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Wed, 13 Jan 2021 18:05:30 GMT</pubDate>
            <atom:updated>2021-01-13T18:05:30.469Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FnJXv-VetMlE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnJXv-VetMlE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FnJXv-VetMlE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e37ffcf8afff9fa3600350ba9f7f0265/href">https://medium.com/media/e37ffcf8afff9fa3600350ba9f7f0265/href</a></iframe><blockquote><strong>As you know, a slideshow is made up of several images and videos changing over time. So how do you create a simple image slideshow using Javascript?</strong></blockquote><blockquote><strong>First, we enter our IMG tag in the HTML section.</strong></blockquote><blockquote><em>Then we give it name , width and height . These values ​​may change depending on your wishes. Now, we select the images to use in the slideshow according to the dimensions we have specified in the </em><strong><em>img </em></strong><em>tag. If you have difficulty finding a picture, you can find pictures of the desired size on the Internet. You can use the JavaScript section by copying the address of the images from those pages.</em></blockquote><pre>&lt;h1&gt;How do we make basic image slideshow in JavaScript?&lt;/h1&gt;</pre><pre>&lt;img name = &quot;slide&quot; width=&quot;600px&quot; height=&quot;550px&quot;&gt;</pre><blockquote><strong>After completing our small code on the Html side, let’s move on to the main part, JavaScript. First of all, let’s define a variable that will change our images constantly:</strong></blockquote><p><em>var i = 0;</em></p><blockquote><strong>Next, we define a variable to be able to use the images whose addresses we copied:</strong></blockquote><pre>var images = [</pre><pre>&#39;https://i.picsum.photos/id/930/600/550.jpg?hmac=kKHfKs3qsuq7uoEIS7Ur-1vQTxDRK7gX1skPd96rIaY&#39; ,</pre><pre>&#39;https://i.picsum.photos/id/788/600/550.jpg?hmac=1xjDBtOo_s0Vmd0GWOSx94e_gVSL0U4FbJeqkQuazKs&#39; ,</pre><pre>&#39;https://i.picsum.photos/id/929/600/550.jpg?hmac=_g-KQ7PUQeAYYlaEOGhCv-r9pnk1NWaF_wC6fMDdBsQ&#39; ,</pre><pre>&#39;https://i.picsum.photos/id/969/600/550.jpg?hmac=DY_HHMaA2njmR8OsUWzjJtdskvCHzpPjQwx4bG8gOJw&#39; ,</pre><pre>];</pre><blockquote><strong>As we said at the beginning, a slideshow is made up of images changing over time. Now we have to set that time interval:</strong></blockquote><p><em>var timeDuration = 2000; //(1000 = 1 second)</em></p><blockquote><strong>Now we create a function to gather all our variables together and do the main work.</strong></blockquote><p><em>function slideFunction () {}</em></p><blockquote>The first thing we will do is associate the <strong><em>images</em></strong><em> </em>variable in the HTML section with the <strong><em>img</em></strong><em> </em>tag in the JavaScript section. To do this:</blockquote><p>document.slide.src = images [i];</p><blockquote><strong>Now we need to write code that will allow our images to rotate consistently.</strong></blockquote><pre>if ( i &lt; images.length - 1) {</pre><pre>i++;</pre><pre>}</pre><pre>else {</pre><pre>i = 0;</pre><pre>}</pre><blockquote>While looking at this code, you may ask why<strong> <em>i &lt; images.length — 1</em></strong><em>?</em></blockquote><blockquote>Let’s discuss this after completing our code.</blockquote><blockquote><strong>Now let’s apply the time duration to our function:</strong></blockquote><pre><strong>setTimeout</strong>( &quot;slideFunction()&quot;, timeDuration);</pre><p>Pictures will now appear in the time interval we applied, and after that interval, pictures will move to another picture.</p><blockquote><strong>Now we need to make sure that the codes we write are visible on our website. To do this:</strong></blockquote><pre>window.<strong>onload</strong> = <strong>slideFunction</strong>();</pre><p>With the help of this code, all the codes we write within the slideFunction function will start working after the web page is fully loaded.</p><blockquote><strong>Let’s put together all the codes we wrote:</strong></blockquote><pre>var i = 0;</pre><pre>var <strong>images</strong> = [</pre><pre>&#39;https://i.picsum.photos/id/930/600/550.jpg?hmac=kKHfKs3qsuq7uoEIS7Ur-1vQTxDRK7gX1skPd96rIaY&#39; ,</pre><pre>&#39;https://i.picsum.photos/id/788/600/550.jpg?hmac=1xjDBtOo_s0Vmd0GWOSx94e_gVSL0U4FbJeqkQuazKs&#39; ,</pre><pre>&#39;https://i.picsum.photos/id/929/600/550.jpg?hmac=_g-KQ7PUQeAYYlaEOGhCv-r9pnk1NWaF_wC6fMDdBsQ&#39; ,</pre><pre>&#39;https://i.picsum.photos/id/969/600/550.jpg?hmac=DY_HHMaA2njmR8OsUWzjJtdskvCHzpPjQwx4bG8gOJw&#39; ,</pre><pre>];</pre><pre>var <strong>timeDuration</strong> = 2000;</pre><pre>function  <strong>slideFunction</strong>() {</pre><pre><strong>document.slide.src</strong> = images[i];</pre><pre>if ( i &lt; images.length - 1) {</pre><pre>i++;</pre><pre>}</pre><pre>else {</pre><pre>i = 0;</pre><pre>}</pre><pre><strong>setTimeout</strong>( &quot;slideFunction()&quot;, timeDuration);</pre><pre>}</pre><pre>window.<strong>onload</strong> = <strong>slideFunction</strong>();</pre><p><em>In the end, if we run our code, we will get the same project as in the video.</em></p><blockquote>Now let’s look at the question we faced above. Why not <strong><em>i &lt; images.length </em></strong>, <strong><em>i&lt;images.length-1</em></strong> ?<br>To understand this clearly, let’s examine and compare both cases.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDClilzU1ce8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDClilzU1ce8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDClilzU1ce8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bdfa50293fbc12d0d906507b13140703/href">https://medium.com/media/bdfa50293fbc12d0d906507b13140703/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FqPSFF8aLU_8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqPSFF8aLU_8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FqPSFF8aLU_8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b45543f9184d4c6333b9f4d8e9eb6b2e/href">https://medium.com/media/b45543f9184d4c6333b9f4d8e9eb6b2e/href</a></iframe><blockquote><strong>As you can see in the difference, when we use i &lt;images.length, it eventually returns an empty value. It is advisable to use i &lt;images.length-1, as this distorts the slide image.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0c661f0db16" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/how-do-we-make-basic-image-slideshow-in-javascript-c0c661f0db16">How do we make basic image slideshow in JavaScript?</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alert, confirm and prompt functions in Javascript.]]></title>
            <link>https://lacrimosaz.medium.com/alert-confirm-and-prompt-functions-in-javascript-176ac5ec9a76?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/176ac5ec9a76</guid>
            <category><![CDATA[prompt]]></category>
            <category><![CDATA[confirms]]></category>
            <category><![CDATA[functions-in-javascript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[alerts]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 06:22:03 GMT</pubDate>
            <atom:updated>2021-01-11T21:42:27.794Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDTG32oHBu_S4zmkpPQ_GA.jpeg" /></figure><blockquote><strong>One of the most interesting topics for beginners in Javascript is features. It is used for notification or confirmation of transactions.</strong></blockquote><blockquote><strong><em>In this article I will talk about the most frequently used functions in javascript: “alert”, “prompt”, “confirm”.</em></strong></blockquote><blockquote><strong>What is the alert function?</strong></blockquote><p>It is mainly used to show users a message, ie a kind of warning. For example:</p><p><strong>alert (“Hello World!”);</strong></p><p>And our output will be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0L_s3QyVmjUiqkBoPOu9w.png" /></figure><blockquote><strong>What is the Prompt function?</strong></blockquote><p>The Prompt command is used to get input from a single user, ie the keyboard. And there are 2 ways to use it:</p><blockquote>1)<strong>prompt</strong>(“Whats is your name?”);</blockquote><p><strong>And our output is:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*IySARdb0b-9iLSo4GnPbjg.png" /></figure><p>2)<strong>prompt</strong>(‘What is your name?’, “Mack”);</p><p>And our output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*H5mTj1IK-Gu-gCwHsj_GFQ.png" /></figure><p><strong>As you can see, we were greeted by “Mack” which we wrote by default.</strong></p><blockquote>As you can see, we received input from the user with prompt. But before we get the input, we have to apply it to some variable so that the function we wrote about later doesn’t “fly away”.</blockquote><ol><li>var variable = <strong>prompt</strong>(“How old are you?”);</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsCMJMp2H6jicmx2oXo2jA.png" /></figure><p><em>2) var variable = prompt(“How old are you?” , ‘19’);</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLgQP16oGRZqzV8aWeWWNg.jpeg" /></figure><p><strong>As you can see, our function is already stored in a variable, and we can call it again at any time.</strong></p><blockquote><strong>What is the Confirm function?</strong></blockquote><p>As you know, some programs, websites, and even operating systems ask us for permission for some of the operations we see. For example, if you want to delete any file or image in Windows, you will be faced with a permission window like “Are you sure you want to delete this file?”.</p><p>In Javascript, this is done with the <strong>confirm</strong> function. The confirm function is used to get permission from the user. Consists of a two-button window (True / False). How to use: The Confirm function will return “true” if the user selects “Ok”, and “false” if “Cancel”:</p><p><strong>var variable = confirm(“Do you wany delete this folder?”);</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*VpxBoZvHZOsl9cGq4f5TUQ.jpeg" /></figure><blockquote><strong><em>What are the disadvantages of Javascript functions?</em></strong></blockquote><ol><li>The browser function can display the output anywhere. Bi Firefox is in the middle of the screen in Mozilla, and at the top of the screen in Opera and Chrome.</li><li>Increase the width of the window, give it color and shape, etc. It is impossible to do style work like.</li><li>Before using the website, you must click ok, cancel or ESC in the window that opens to close the window.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EPMcXeM76ajcyWc_AgzQ5A.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=176ac5ec9a76" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cryptocurrency: What is the pi coin and how is it mining ?]]></title>
            <link>https://lacrimosaz.medium.com/cryptocurrency-what-is-the-pi-coin-and-how-is-it-mining-c0b43954dce4?source=rss-2240cc6984aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0b43954dce4</guid>
            <category><![CDATA[pi-network-coin]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[pi-network]]></category>
            <category><![CDATA[cyrptocurrency]]></category>
            <category><![CDATA[pi-coin]]></category>
            <dc:creator><![CDATA[Nihad]]></dc:creator>
            <pubDate>Sun, 10 Jan 2021 20:33:09 GMT</pubDate>
            <atom:updated>2021-01-10T20:33:46.566Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong><em>Cryptocurrency: What is the Pi coin and how is it mining ?</em></strong></h3><blockquote><strong>What is a cryptocurrency?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*xMkvk8Z9eVPZcyRknV5ecA.jpeg" /></figure><p>Cryptocurrencies are completely digital, encrypted virtual currencies used in currency exchange. Some analysts even call cryptocurrencies the money of the future. Currently, with the devaluation of the state currency in some countries, cryptocurrencies have become the state currency.</p><blockquote><strong>What are the advantages of cryptocurrencies?</strong></blockquote><p>The biggest advantage of cryptocurrencies is that they do not depend on state banks. This means that it does not depend on the economic situation. Another advantage is that someone else can’t freeze your currency account and seize the account.</p><p>Today, with the rapid appreciation of bitcoin, people’s interest in cryptocurrencies has begun to grow. Among these cryptocurrencies is the newly created pi coin, which is currently gaining popularity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*iTW1ZWSKKFK-oPRj0QqJow.jpeg" /></figure><blockquote><strong>What is the pi coin?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*7WS9VLKGWNyJv9CgNXqp7A.jpeg" /></figure><p>Pi is a cryptocurrency based on a stellar platform. Although the cryptocurrency is not currently available on trading platforms, analysts say the current value of the cryptocurrency is close to $ 15. Rapid development indicates that the value of this currency will increase as it enters the market.</p><blockquote><strong>What is the Pi network and how can we mine Pi coin?</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*H2unxxCcwcDAzVtkx62QRg.jpeg" /></figure><p>The pi coin is a kind of cryptocurrency that you can <strong>mine</strong> through the pi network program. This program is <strong>mining</strong> by logging in without any payment. The program requires a referral code when you have a <strong>login</strong>. Each user who accesses the pi network program through your referral code earns you <strong>one</strong> pi, and the more they actively <strong>mine</strong> (mining) the higher your pi gain. The program is currently completely free. However, in the next 1–2 years, with the increase in the number of users of the program and its entry into the foreign exchange market, there will be cases of non-free <strong>mining </strong>and halving the ratios. This is normal for the cryptocurrency market. Bitcoin is a clear example of this. If you want to invest in your future, it is better to hurry.</p><blockquote><strong>For those looking for a reference code: You can register for free using the reference code Cyclopss1</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0b43954dce4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>