<?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: Zhanna Balyan</title>
    <description>The latest articles on DEV Community by Zhanna Balyan (@zhanna_balyan).</description>
    <link>https://dev.to/zhanna_balyan</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%2F925041%2F5425843e-0f55-438c-a2aa-f4b5102b16a7.png</url>
      <title>DEV Community: Zhanna Balyan</title>
      <link>https://dev.to/zhanna_balyan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zhanna_balyan"/>
    <language>en</language>
    <item>
      <title>Java Script functions</title>
      <dc:creator>Zhanna Balyan</dc:creator>
      <pubDate>Wed, 09 Nov 2022 19:59:03 +0000</pubDate>
      <link>https://dev.to/zhanna_balyan/java-script-functions-4bai</link>
      <guid>https://dev.to/zhanna_balyan/java-script-functions-4bai</guid>
      <description>&lt;p&gt;Hello everyone and I’d like to welcome you all to my blog. During my previous posts we discovered the basic knowledge required for learning Java Script. We’ve discussed variables, scopes and what we can do with variables. In this post, we will learn about functions. The functions in Java Script are very identical to the functions we all know from mathematics. Basically functions are statements that perform some task or compute some value. Or we can say that it is a code implemented to perform a particular task. A function performs the task when we “call” it. It needs to take in some input and produce an output. For a function to work, we need to define it in the scope from which we want to call it. In simple and clear language a function consists of several statements but it displays only a single statement. We write a function in the following way. First we write the keyword function, then we write the name of the function, which can include letters, digits, underscores, and next to it we write the parameters of the function inside braces.  Finally we write the main body of the function inside the curly parenthesis. After all of this, we call the function and it gives us some value in return. Let’s look at an example and understand the concept of functions better.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bUQLADFr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4slr5uge7hosu2i6mg3.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bUQLADFr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4slr5uge7hosu2i6mg3.jpeg" alt="Image description" width="880" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, let’s understand this example. The function reads the steps starting from the first line. So, first it understands that we have assigned a function to the variable x. It contains two arguments.  It sees that there is a condition of multiplying the arguments and returning them to us.  Finally, it reaches to the point where it prints the value that it needed to return to us. The return statement indicates that the function has ended and any other code coming after that will not be executed.&lt;/p&gt;

&lt;p&gt;Functional programming can seem a bit complex but in reality, functions are our friends as they have lots of benefits. For example, it is reusable. We can call our function numerous times and save many lines of coding. So we don’t have to do code repetition. Furthermore, it can break down a large program into smaller programs and make it easier to read.&lt;/p&gt;

&lt;p&gt;There are several ways of declaring functions. A function declaration is simply the process of giving instructions to the function for it to implement them. A function can also be declared by function expression. This kind of expression uses variables to declare the name of the function. It comes before the word “function”. The function is declared by calling it. This specifies the name of the function and it helps us in tracing bugs. There is another type of functions called Construction functions. It is when we create several objects which are similar to each other. We denote it with the keyword “new Function”. Construction functions are getting executed in the global scope.&lt;/p&gt;

&lt;p&gt;Arrow functions are somewhat similar to function expressions. This is the case when we don’t use the keyword “function”. We name our function, list the arguments inside the brackets and then we use an arrow sign and indicate the values in curly parenthesis. Arrow functions are more convenient as they save time.&lt;/p&gt;

&lt;p&gt;So, these were the basic things you all need to know about Java Script. Hope this helped you. Thank you for your attention.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>functions</category>
    </item>
    <item>
      <title>Java Script variables</title>
      <dc:creator>Zhanna Balyan</dc:creator>
      <pubDate>Wed, 09 Nov 2022 19:57:28 +0000</pubDate>
      <link>https://dev.to/zhanna_balyan/java-script-variables-4ln8</link>
      <guid>https://dev.to/zhanna_balyan/java-script-variables-4ln8</guid>
      <description>&lt;p&gt;Hey everyone. Welcome back to my blog. Last time we talked about binary numbers and operations but this time we are going to go a little deeper and talk about programming languages, in particular Java Script. As we all know there are several programming languages, which in simpler words, are tools for people to communicate with computers.  One of such programming languages is Java Script. It is a dynamic, lightweight, object-oriented language. Originally, it was designed by a programmer named Brendan Eich for usage in web browsers. But now it is used in several fields. For example, with the help of Java Script people can develop web and mobile apps, create games, build servers etc. It is one of the most popular languages as it is easy to read, is versatile and there is a high demand for it. So much for the introduction, now let’s dive deeper into the main topic and understand how Java Script works.&lt;/p&gt;

&lt;p&gt;In Java Script, there are different data types. We have strings, arrays, objects, functions and so on. Like any other programming languages, Java Script has variables. Those are simply places for storing data. Variables are the most fundamental and important parts of programming languages. We can put pretty much anything in variables ranging from just numbers and texts to functions and other complex data. We can reference the data inside the variable numerous times. Furthermore, we can later modify or reassign a different value to it. There are three ways to declare variables. We do that with the help of keywords “var”, “let” and “const”. The code understands the variable differently in each case. In the past, we only used var for declaring variables and then we got introduced to let and const. We use var to describe the variable. We write the name of the variable next to var. Then we assign the variable by putting the “=” sign. Next we write the value that needs to be assigned. There are some restrictions that we need to follow. For example we can’t use spaces or tabs. The value assigned to the variable needs to be put inside parenthesis. Also, the variable needs to have a unique name. Let’s look at a simple example to understand how variables are written.&lt;/p&gt;

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

&lt;p&gt;We can see that our variable is named animal and its value is dog.&lt;/p&gt;

&lt;p&gt;Now if we print the variable with the help of console.log, which is a function used for outputting messages, it will print “dog”.&lt;/p&gt;

&lt;p&gt;Var and Let are somewhat similar but the difference between them is that var is function-scoped and let is block-scoped. Scopes in Java Script refer to the visibility or accessibility of the variable. In other words, they determine where the variable can be used. There are two scopes, global and local. Global variables can be redeclared outside of a block, meanwhile local variables are declared inside of a block.  And this is the key difference between let and var. Let allows us to declare variables which are limited to a block statement but var lets us redeclare the variables. So the let variables need to be declared before use. The example below will show exactly what I’m talking about.&lt;/p&gt;

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

&lt;p&gt;As we can see, the variable X can not be used outside of the curly brackets.&lt;/p&gt;

&lt;p&gt;Now that we know what var and let are, there is only one last type of variable that we need to define. It is const. Constants are values that can not be reassigned or changed. We write them just like the other two variables. First, we write the constant’s name and then its value. This is shown in the example below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5Y1_uigV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0etdx197i44r4yhc08s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5Y1_uigV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0etdx197i44r4yhc08s.png" alt="Image description" width="494" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, to sum up, we’ve learned the fundamental and basic things about Java Script and data types used there. Now that you have this information, you can have fun trying to code something yourself. Thank you for reading.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>variable</category>
      <category>programming</category>
    </item>
    <item>
      <title>All about binary numbers</title>
      <dc:creator>Zhanna Balyan</dc:creator>
      <pubDate>Wed, 14 Sep 2022 21:09:20 +0000</pubDate>
      <link>https://dev.to/zhanna_balyan/all-about-binary-numbers-53j7</link>
      <guid>https://dev.to/zhanna_balyan/all-about-binary-numbers-53j7</guid>
      <description>&lt;p&gt;Hey everyone. In this post we are going to talk about binary numbers and dig a little further on the operations we can do with them. In our everyday life we always use the decimal numbers from 0 to 9 in order to represent, count and do operations with different numbers. Any possible number we can think of consists of those digits. However, the computers don’t work this way. They only use two digits, which are “0” and “1”. All the numbers can be expressed using these two digits. The system, consisting of only two digits “0” and “1”, is called a binary system or a base 2 number system. The digits are also called binary digits or simply bits. Bits are the smallest units of data and by combining bits we create larger units like bytes, which computers use to store and process information. Binary number system is the base for all binary codes used in computing systems. There are numerous operations that we can perform on binary numbers. For example, by knowing the decimal number we can convert it into a binary number and vice versa. In order to perform these two operations, we need to be familiar with the powers of two because that is what we are going to use during the conversion process. This can be done in two ways and I’m going to show both of them by also using examples. The first method is the subtraction method.  Let’s take the number “55” and show how we can convert it into a binary by using the subtraction method. First, we need to list the powers of two until we reach a number that exceeds our number.&lt;/p&gt;

&lt;p&gt;64, 32, 16, 8, 4, 2, 1&lt;/p&gt;

&lt;p&gt;Then we find the greatest power of two which is less than “55” and subtract it from the number.&lt;/p&gt;

&lt;p&gt;55-32=23&lt;/p&gt;

&lt;p&gt;Then we take the highest power of two which is smaller than the result and subtract it and repeat the process until the result is “0”.&lt;/p&gt;

&lt;p&gt;55-32=23-16=7-4=3-2=1-1=0&lt;/p&gt;

&lt;p&gt;We then represent the number by the sum of the powers of two that we used during the process.&lt;/p&gt;

&lt;p&gt;55→ 32+16+4+2+1&lt;/p&gt;

&lt;p&gt;After that, we start putting a “0” in the places of the powers of two that we haven’t used during the subtraction and “1” in the places of the powers of two that we’ve used.&lt;/p&gt;

&lt;p&gt;64(0), 32(1), 16(1), 8(0), 4(1), 2(1), 1(1)                                                                       110111&lt;/p&gt;

&lt;p&gt;In this example we got “110111” which is a binary number.  We can also convert decimals into binary numbers by using the method of division. Here we just need to divide the number by two to the point where we reach “1” and write the remainders.  Then we simply place the remainders from bottom to up and get our binary number, in this case “110111”. Since it’s a little inconvenient to type an example here, I am going to use a picture for you to understand it better.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dNTQKnu_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vr2xbiwsll7f5z37vyiu.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dNTQKnu_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vr2xbiwsll7f5z37vyiu.jpeg" alt="Image description" width="880" height="717"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we master this process, we can easily do the opposite operation, convert the binary into a decimal. For this, we again need to use the powers of two. Let’s carry on with our previous example.  If we want to represent “110111” as a decimal number we need to complete these basic steps.                                                                                                                                                                      1) Find corresponding decimals for each bit in the increasing order from right to left&lt;/p&gt;

&lt;p&gt;110111                                                                                                                             (543210)                                                                                                                                                      &lt;/p&gt;

&lt;p&gt;2)Represent each of the bits as a product of 2 to the power of its corresponding decimal value and the bit itself. For example 1= 2^5x1                               &lt;/p&gt;

&lt;p&gt;3)Add all the products together to get the decimal number.                                      2^5x1+2^4x1+2^3x0+2^2x1+2^1x1+2^0x1= 32+16+4+2+1=55&lt;/p&gt;

&lt;p&gt;And that’s how we get our result.&lt;/p&gt;

&lt;p&gt;After we recognize and get comfortable with the concept of binary numbers and how they are represented, we can easily do mathematical operations with them such as addition, multiplication, subtraction and division.&lt;/p&gt;

&lt;p&gt;The addition of two binary numbers is done by a method well-known to us from school. But we need to be careful because in the binary system “1+1” means “10”. So, we add binary numbers the same way we add decimals and when we have “1+1” we write “0” and carry the “1” to the next column. It’s a pretty easy process and you can find an example below where the process is shown step by step.&lt;/p&gt;

&lt;p&gt;The same process applies to the multiplication. Here, again, we need to be careful in the final part of the operation where we add the results we got because when we add “1+1”, we write “0” and carry the “1” to the next column (see the example for better understanding). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G2GF3WQS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/64p27qqng17840i69ao8.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G2GF3WQS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/64p27qqng17840i69ao8.jpeg" alt="Image description" width="880" height="1295"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;The subtraction of binary numbers is done pretty much the same way. Except, here we need to remember that “0-1” equals to “1”. Because 0 is less than 1, we can’t subtract it, so we borrow the “1” from the next column and continue our process following from that.&lt;/p&gt;

&lt;p&gt;And the last operation we’re going to talk about is the division of two binary numbers. Once again, the process is quite similar to the division we all know from school. We divide the binary numbers just like we divide the decimals. We only need to take into account the fact that if there is a subtraction “0-1” we need to borrow 1 from the next digit and write “1”.  Here, again, I’ve illustrated the process with an example. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jJRBJHGG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c7h0z8oxymh6d687crcu.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jJRBJHGG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c7h0z8oxymh6d687crcu.jpeg" alt="Image description" width="880" height="1400"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;By far, we’ve covered everything you need to know about binary numbers and the simple mathematical operations that can be performed on them. Hope this post helped you find the answers to your questions! Thank you all for reading and your attention.                                                                                                &lt;/p&gt;

</description>
      <category>binary</category>
      <category>operations</category>
    </item>
  </channel>
</rss>
