<?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: Shahaparan</title>
    <description>The latest articles on DEV Community by Shahaparan (@poran).</description>
    <link>https://dev.to/poran</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%2F38702%2Ff0884bef-0e7f-4846-8ce8-397a25f26b88.jpg</url>
      <title>DEV Community: Shahaparan</title>
      <link>https://dev.to/poran</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/poran"/>
    <language>en</language>
    <item>
      <title>How to create JS Functions</title>
      <dc:creator>Shahaparan</dc:creator>
      <pubDate>Thu, 23 Nov 2017 17:10:08 +0000</pubDate>
      <link>https://dev.to/poran/how-to-create-js-functions-2b6</link>
      <guid>https://dev.to/poran/how-to-create-js-functions-2b6</guid>
      <description>&lt;p&gt;javascript ,Reactjs, nodejs,vuejs&lt;/p&gt;

&lt;p&gt;How to create JS Functions &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;something about function&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Function means "Building Blocks" of the program . It can allow to reuse the code without repetition. For Example , we need to create shopping cart . To get AddItemCart , total-amount . It is used for the program .&lt;/p&gt;

&lt;p&gt;Let's talk about function . How to create Functions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Function Declaration:
&lt;/h1&gt;

&lt;p&gt;function Createfunction(){&lt;br&gt;
  alert("Hello world!");&lt;br&gt;
}&lt;br&gt;
Createfunction();&lt;/p&gt;

&lt;p&gt;Let's explain the code . "function" is keyword which have to write first  then I create function Name which can be wrote any-letter and The parameters will be the brackets(empty in the example above) . Finally, Function body code where you have to write your all codes .&lt;/p&gt;

&lt;p&gt;Createfunction() is called for function output . If you write two times, the output will show two times . it executes the code of the functions. &lt;/p&gt;

&lt;h1&gt;
  
  
  Local variable:
&lt;/h1&gt;

&lt;p&gt;Local variable declared inside the function body is only visible that function . Make sure that when You will write the title of function name , You can write the first letter of word can be capital letter because it will help you to see look nice .. Example:CreateMyName. In addition, I will write later how to write properly the name of  function.&lt;/p&gt;

&lt;p&gt;Example:1&lt;/p&gt;

&lt;p&gt;function CreateMyName(){&lt;br&gt;
  var name = "poran";&lt;br&gt;
  alert(name);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;CreateMyName(); // output :  poran &lt;br&gt;
alert(name); // Error output because Variables is called as a local .&lt;/p&gt;

&lt;h1&gt;
  
  
  outer Variable:
&lt;/h1&gt;

&lt;p&gt;outer variable declared outside of the function . &lt;br&gt;
Example:2&lt;/p&gt;

&lt;p&gt;var name = "poran";&lt;br&gt;
function ShowName(){&lt;br&gt;
  var nickName = "Shaha" + name;&lt;br&gt;
  alert(nickName);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;ShowName(); // output : Shahaporan&lt;/p&gt;

&lt;p&gt;Outer variable is worked as global variables.It has full accessed and modify in the code .&lt;/p&gt;

&lt;p&gt;Example:3&lt;/p&gt;

&lt;p&gt;var name3 = "poran"; // outerVariable&lt;br&gt;
function ShowName(){&lt;br&gt;
   name3 =  "Sujon"; // Outer variable is changed .&lt;br&gt;
  var nickName = "My Name is" + name3;&lt;br&gt;
  alert(nickName);&lt;br&gt;
}&lt;br&gt;
alert(name3); // Show outer value&lt;br&gt;
ShowName(); // output : My Name is Shahaporan&lt;br&gt;
alert(name3) // Show changed value&lt;/p&gt;

&lt;p&gt;Here is missing something about outer variables that I will write next articles .&lt;/p&gt;

&lt;p&gt;"Happy coding" &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
