<?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 Syed Samid Saud on Medium]]></title>
        <description><![CDATA[Stories by Syed Samid Saud on Medium]]></description>
        <link>https://medium.com/@samidsyed1720?source=rss-d4305b57be46------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XPUABOGrGQiY_-o-</url>
            <title>Stories by Syed Samid Saud on Medium</title>
            <link>https://medium.com/@samidsyed1720?source=rss-d4305b57be46------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 02:25:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samidsyed1720/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[Control statements]]></title>
            <link>https://medium.com/@samidsyed1720/control-statements-e9483b753b81?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9483b753b81</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Sat, 02 Nov 2024 11:40:25 GMT</pubDate>
            <atom:updated>2024-11-02T11:40:25.477Z</atom:updated>
            <content:encoded><![CDATA[<h3>Conditional Statements in javascript🫤</h3><p>JavaScript control flow statements help you manage the sequence in which code executes. They include conditional statemets loops, and exception handling. Here’s a comprehensive breakdown of each type with examples.</p><ol><li><strong>if statement: </strong>Use the <strong><em>if</em></strong> statement to specify a block of code to be executed if a condition is true. <strong><em>if</em></strong> statement is used to execute code based on a condition. If the specified condition evaluates to true, the code inside the if block runs. If it’s false, the code is skipped.</li></ol><pre>let age = 23;<br><br>if (age &gt;= 18) {<br>    console.log(&quot;You are an adult.&quot;);  <br>}<br>//you are an adult</pre><p><strong>2. else if</strong>: Use else statements to specify a block of code is executed the wrong statement. In else if is used to handle multiple conditions in an if statement. It allows you to check additional conditions if the previous if or else if condition was false and evaluate them one by one until a true condition is found, at which point the corresponding block of code runs.</p><pre><br>let age = 10;<br><br>if (age &gt;= 7) {<br>    console.log(&quot;You can have the candy&quot;);  //if true condition pass then it will go it true statment<br>}<br>else{<br>console.log(&quot;Sorry you are too adult&quot;);<br>}   <br>//You can have the candy</pre><p><strong>3. if_else if_else: </strong>The if...else if...else structure is used to control the flow of code by evaluating multiple conditions in a sequence, and the structure allows the program to choose different paths based on different conditions, and else if uses for multiple conditions only.</p><pre><br><br>let num = -2;<br><br>if (num &gt; 0) {<br>  console.log(&quot;Positive&quot;);<br>} else if (num &lt; 0) {<br>  console.log(&quot;Negative&quot;);<br>} else {<br>  console.log(&quot;Zero&quot;); <br>}<br>// Negative</pre><p>4. <strong>Nested if-else</strong>: In nested if...else structure, one if...else statement is placed inside another if or else block.</p><pre>let age = 23;<br><br>if(age &gt;= 18){<br>    console.log(&quot;You are an adult&quot;);<br>    if (age &gt;= 21) {<br>        console.log(&quot;You are eligible for job&quot;)<br>    }<br>    else{<br>        console.log(&quot;You are not eligivle for job&quot;)<br>    }<br>}<br>else{<br>    console.log(&quot;You are a minor&quot;);<br>}<br>//You are an adult<br>//You are eligible for job</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9483b753b81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is implicit and explicit?]]></title>
            <link>https://medium.com/@samidsyed1720/what-is-implicit-and-explicit-f88778261f63?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/f88778261f63</guid>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Sat, 02 Nov 2024 07:08:57 GMT</pubDate>
            <atom:updated>2024-11-02T10:36:14.221Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*CUK4WgYwquDTZDNZ" /></figure><p>In JavaScript, implicit and explicit refer to different ways in which certain behaviors, especially type conversions, can occur within your code. These terms are commonly used when discussing type coercion, function calls, and code clarity.</p><p>List of DataType that can convert</p><ol><li><strong>String</strong> =&gt; Number, Boolean, null, undefined</li><li><strong>Number</strong> =&gt; String, Boolean, null, undefiend</li><li><strong>Boolean</strong> =&gt; String, Number, null, undefiend</li><li><strong>null</strong> =&gt; String, Number, Boolean, undefiend</li><li><strong>undefined</strong> =&gt; String, Number, Boolean, undefiend</li></ol><p>1.1 Any Datatype to String (using + operator)</p><pre>let marks = 2 + &quot;3&quot;;<br>console.log(marks,typeof marks);  //23 string<br><br>marks = &#39;3&#39; + true;<br>console.log(marks,typeof marks);  //3true string<br><br>marks = &#39;3&#39; + undefined<br>console.log(marks,typeof marks);  //3undefined string<br><br>marks = &quot;5&quot; + null;<br>console.log(marks,typeof marks);  //5null string<br><br>marks = false + &quot;10&quot;;<br>console.log(marks, typeof marks);  //false10 string<br><br>let number = 5 + &quot;5&quot;;<br>console.log(number,typeof number); //55 string<br><br>let numbers = &quot;7&quot; + 8;<br>console.log(numbers,typeof number); //78 string</pre><p>2.1 Any datatype to a number (-, /, *)</p><pre><br>let results;<br>results = &quot;4&quot; -2;                //2 number<br>results = &quot;4&quot; + &quot;4&quot;;  44 string<br>results = 4 + 6;                //10 numbers<br>results = &quot;0&quot; - &quot;1&quot;;            //-1 number<br>results = &quot;hello&quot; - &quot;hii&quot;;      //NaN number<br>results = &quot;5&quot; * 3;              //15 number<br>results = &quot;5&quot; - &quot;hi&quot;;          //NaN number<br>results = &quot;5&quot; - true;          // true is 1 and false is 2 <br>console.log(results, typeof results);</pre><p>3.1 Any Datatype of Boolean</p><pre>let check;<br> check = &quot;5&quot; + true;     //5true<br> check = &quot;10&quot; - false;  //10<br> check = 4 - true;      //3<br>console.log(check)</pre><p>4.1 Any Datatype to Null</p><pre> // null = 0<br><br> let test;<br> test = 4 - null;   //4 number<br> test = 4 + null;   //4 number<br> console.log(test, typeof test);</pre><p>5.1 Any Datatype to Undefined</p><pre> let final;<br><br> final = undefined + &quot;Test&quot;;    //undefinedTest string<br> final = 4 - &quot;0&quot;;               //4 number<br> console.log(final, typeof final);</pre><h3>Explicit conversion :</h3><p>In JavaScript, explicit conversions mean changing a value from one type to another on purpose, using specific functions. This way, you control the conversion and avoid any surprises caused by JavaScript’s automatic type changes.</p><ol><li>Convert to Number: Change something into a number.</li></ol><pre>let results;<br>results = Number(&quot;60&quot;);         // 60 number<br>results = Number(&quot;hello&quot;);      //NaN number<br>results = Number(true);         //NaN number<br>results = Number(null);         //0 number<br>results = Number(undefined);    //NaN number<br><br>console.log(results,typeof results);</pre><p>2. Convert to String: Change something into text.</p><pre>let results;<br>results = String(60);       //60 String<br>results = String(&quot;hello&quot;);  //hello string<br>results = String(false);    //false string<br>results = String(&#39;80&#39;);     //80 string<br>results = String(null);     //null string<br>console.log(results,typeof results);</pre><p>3. Convert to Boolean: Change something into true or false.</p><pre><br><br>let results;<br>results = Boolean(&quot;&quot;);       //false boolean<br>results = Boolean(&quot; &quot;);      //true boolean<br>results = Boolean(&#39;hello&#39;);  // true booean<br>results = Boolean(true);     // true boolean<br>results = Boolean(&#39;20&#39;);     // true boolean<br>results = Boolean(null);     //false boolean<br>console.log(results,typeof results);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f88778261f63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Logical, Bitwise, Terenary, typeof and String Operators]]></title>
            <link>https://medium.com/@samidsyed1720/logical-bitwise-terenary-typeof-and-string-operators-d9df1a4a7681?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9df1a4a7681</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Thu, 31 Oct 2024 08:16:29 GMT</pubDate>
            <atom:updated>2024-10-31T08:16:29.795Z</atom:updated>
            <content:encoded><![CDATA[<h3>Logical, Bitwise, Terenary, typeof and String Operators 😇</h3><ol><li><strong>Logical Operators : </strong>They are<strong> </strong>used to determine the logic between variables or values. Given that x = 6 and y = 3, the table below explain the logical operator.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/0*SYk1GwGijgqa8LyN.PNG" /></figure><pre>let a = true;<br>let b = false;<br><br>console.log(a &amp;&amp; b);  // false<br>console.log(a || b);  // true<br>console.log(!a);      // false </pre><p><strong>2. Bitwise Operators</strong>: A bitwise operator in programming is used to perform operations on the binary (0s and 1s) representation of numbers. Instead of dealing with whole numbers directly, bitwise operators manipulate the individual bits (binary digits) within the numbers.</p><p>2.1 AND (&amp;): Compares each bit of two numbers and returns 1 only if both bits are 1; otherwise, it returns 0.<br>2.2 OR (|): Compares each bit and returns 1 if either bit is 1; otherwise, it returns 0.<br>2.3 XOR (^): Compares each bit and returns 1 if only one of the bits is 1; otherwise, it returns 0.</p><pre>console.log(5 &amp; 1); //1<br>console.log(5 | 1); //5<br>console.log(5 ^ 1); //4</pre><p><strong>3. Ternary Operator</strong> : The ternary operator in JavaScript provides a shorthand way of writing an if-else statement in a single line. It’s represented by the ? and : symbols and takes form</p><pre>let exam = 60;<br>let result = exam &gt;= 100 ? &quot;You are qualified.&quot; : &quot;Better luck next time.&quot;<br>console.log(result) //Better luck next time</pre><p>Here are step that how its works:</p><p><strong>condition</strong> — an expression that is evaluated as true or false.<br><strong>expressionIfTrue— </strong>the code that runs if the condition is true.<br><strong>expressionIfFalse</strong>—the code that runs if the condition is false.</p><p>4. <strong>typeof:</strong> Check or manipulate the type of a variable</p><pre>console.log(typeof &quot;hello&quot;); //string<br>console.log(typeof 35);  //number<br>console.log(typeof true); //boolean<br>console.log(typeof false); //boolean<br><br>console.log(typeof {}); //object<br>console.log(typeof []); //object // array is also an object<br>console.log(typeof null) // object<br>//! there was a bug in javascript which says typeof array and null is an oblects</pre><p><strong>Note</strong>: by default in a javascript array, and objects of the data type are objects. The bug was null is an object.</p><p>5.<strong> Strings</strong>: string operators are primarily used to work with and manipulate strings.</p><pre>let fname = &quot;Suhail&quot;;<br>let lname = &quot;Roushan&quot;;<br>console.log(fname + lname); //SuhailRoushan<br>----------------------------------------------------<br>let name = &quot;Syed&quot; + &quot; &quot; + &quot; samid&quot;;<br>console.log(name);  // Syed samid</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9df1a4a7681" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Operators: Assignment & Arithmetic.]]></title>
            <link>https://medium.com/@samidsyed1720/javascript-operators-assignment-arithmetic-9f1c51c37a30?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f1c51c37a30</guid>
            <category><![CDATA[operators]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 13:14:52 GMT</pubDate>
            <atom:updated>2024-10-30T16:40:41.036Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript operators are symbols or words that perform operations on values (often called operands) to produce a result. They are essential for manipulating data and creating logic within programs.</p><h3>1. Arithmetic Operators:</h3><p>These operators perform basic mathematical operations</p><ol><li>Addition (+): Adds two values.</li></ol><pre>let result = 5 + 3; // 8</pre><p>Subtraction (-): Subtracts one value from another.</p><pre>let result = 5 - 3; // 2</pre><p>Multiplication (*): Multiplies two values.</p><pre>let result = 5 * 3; // 15</pre><p>Division (/): Divides one value by another.</p><pre>let result = 6 / 3; // 2</pre><p>Modulus (%): Finds the remainder of division</p><pre>let result = 7 % 3; // 1</pre><p>Exponentiation (**): Raises a value to the power of another</p><pre>let result = 2 ** 3; // 8</pre><h3>2. Assignment Operators:</h3><ol><li><strong>Initial Assignment</strong>: Here, we assign the value 10 to x and log it. So, x is initially 10.</li></ol><pre>let x = 10;<br>console.log(x); // 10</pre><p>2. <strong>Addition Assignment (+=)</strong>: x = x + 5<br>We have added 5 to the current value of x, which is 10, so x will be 15.</p><pre>x += 5;<br>console.log(x); // Output: 15</pre><p>3. <strong>Subtraction Assignment (-=)</strong>: x = x—3.<br>We subtract 3 from the current value of x (which is 15), so x will be 12.</p><pre>x -= 3;<br>console.log(x); // 12</pre><p>4.<strong> Multiplication Assignment (*=)</strong>: x = x * 2.<br>We multiply the current value of x (which is 12) by 2, so x will be 24.</p><pre>x *= 2;<br>console.log(x); // 24</pre><p>5. <strong>Division Assignment (/=)</strong>: x = x / 4.<br>We divide the current value of x (which is 24) by 4, so x will be 6.</p><pre>x /= 4;<br>console.log(x); // 6</pre><p>6. <strong>Modulus Assignment (%=): </strong>x = x % 2.<br>We take the remainder when the current value of x (which is 6) is divided by 2. Since 6 is evenly divisible by 2, the remainder is 0, so x will be 0.</p><pre>x %= 2;<br>console.log(x); // 0</pre><p>x %= 2;<br>console.log(x)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f1c51c37a30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are Objects and Arrays?]]></title>
            <link>https://medium.com/@samidsyed1720/what-are-objects-and-arrays-075ce597d9ba?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/075ce597d9ba</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[objects-in-javascript]]></category>
            <category><![CDATA[array-methods]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 11:53:22 GMT</pubDate>
            <atom:updated>2024-10-30T11:53:22.045Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*q4P8NRxMZSN36YMQ.jpg" /></figure><p><strong>Objects</strong>:</p><ol><li>An object is a collection of key-value pairs, where each key (also called a “property”) has a corresponding value.</li><li>Objects are ideal for storing related data and more complex structures.</li><li>Each key is unique and is usually a string, though ES6 symbols can also be used.</li><li>Object syntax is enclosed in curly braces {person} with key-value pairs inside, separated by commas.</li><li>Objects are unordered and store data in key-value pairs, which are ideal for descriptive or structured data.</li></ol><p>Here is an example of an objects…</p><pre>let myAmazonUser = {<br>    firstName: &quot;syed samid&quot;,<br>    phone: &quot;898384794&quot;,<br>    age: &quot;23&quot;,<br>    address: &#39;hydreadbad&#39;,<br>    gender: &quot;Male&quot;,<br>    active: true,<br>    cart: null,<br>    totalShopping: [&quot;iphone&quot;, &quot;samsung&quot;],<br>};</pre><p>This will update the data into main object.</p><pre>myAmazonUser.active = false;<br>console.log(myAmazonUser)<br><br>myAmazonUser.gender = &quot;female&quot;;<br>console.log(myAmazonUser);</pre><p>This will add value to object.</p><pre>myAmazonUser.id =&quot;AMZ89887&quot;;<br>console.log(myAmazonUser);</pre><p>To delete a particular key.</p><pre>delete myAmazonUser.cart;<br>console.log(myAmazonUser);</pre><p><strong>Array:</strong></p><ol><li>An array is an ordered list of values. This values can be of any type, and an array can store multiple types at once.</li><li>Arrays are commonly used to store collections of data, especially when the data items share a similar nature.</li><li>Each element in an array has a unique index, starting from 0.</li><li>Array syntax is enclosed in square brackets [], with elements separated by commas.</li><li>Arrays are ordered lists, where each element is accessed by its index, making them better for ordered data or lists of items.</li></ol><p>Example:</p><pre>let number = [1, 2, 3, 4, 5];<br>// let mixedArray = [1, &quot;Hello&quot;, true, {id : 1}, [10, 20]];             <br>console.log(number,mixedArray)<br> console.log(number[3]);<br> console.log(mixedArray[4][0]);<br><br>output:<br>[ 1, 2, 3, 4, 5 ] [ 1, &#39;Hello&#39;, true, { id: 1 }, [ 10, 20 ] ]<br>4<br>10</pre><p><strong>Adding or Removing Elements</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bUssDU0MZKOLL7oc.jpg" /></figure><ol><li>push(): It add an element to the end of the array.</li></ol><pre>let arr = [1, 2];<br>arr.push(3); // arr is now [1, 2, 3]</pre><p>2. pop(): Removes the last element from the array.</p><pre>let arr = [1, 2, 3];<br>arr.pop(); // arr is now [1, 2]</pre><p>3. unshift( ): It will add an element to the beginning of the array.</p><pre>let arr = [2, 3];<br>arr.unshift(1); // arr is now [1, 2, 3]</pre><p>4. shift(): It will Removes the first element from the array.</p><pre>let arr = [1, 2, 3];<br>arr.shift(); // arr is now [2, 3]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=075ce597d9ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Types in Javascript]]></title>
            <link>https://medium.com/@samidsyed1720/data-types-in-javascript-89f9dca8f05e?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/89f9dca8f05e</guid>
            <category><![CDATA[primitive-data-types]]></category>
            <category><![CDATA[datatypes-in-javascript]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 07:04:32 GMT</pubDate>
            <atom:updated>2024-10-30T12:02:39.523Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rJh5sH0sqsHbM2TX" /></figure><p>In JavaScript, data types are broadly categorized into two categories — primitive types and non-primitive types.</p><p>Primitive data types are basic data types that represent a single value, whereas non-primitive data types are complex data types that represent a collection of values.</p><p>Primitive data types are further classified into 6 types:</p><ol><li>Numbers</li><li>String</li><li>Boolean</li><li>Undefined</li><li>Null</li></ol><p><strong>Number: </strong>The number data type represents numerical values, which can be integers, decimals or floating-point numbers. Numbers can be manipulated using various mathematical operations.</p><pre>let num = 10;<br>let pi = 3.14;</pre><p><strong>String: </strong>A string is a sequence of characters enclosed in single or double quotes. It represents text values and can be manipulated using various string methods.</p><pre>let name = &#39;Hello World&#39;;<br>console.log(name);</pre><p><strong>Boolean: </strong>A boolean represents a logical entity that can have only two values — true or false. Booleans are often used for conditional testing and are typically the result of a comparison operation.</p><pre>let isTrue = true;<br>let isFalse = false;</pre><p><strong>Undefined: </strong>When a variable is declared but not assigned a value, its value is undefined. Undefined is also a data type in JavaScript that represents the absence of a value.</p><pre>let x;<br>console.log(x); // Output: undefined</pre><p><strong>Null: </strong>The null data type represents the intentional absence of any object value. It is often used to signify that a variable has no value assigned to variables.</p><p><strong>Conclusion</strong>: In JavaScript’s primitive data types are essential, providing the basis for all data handling in the language. Their immutability, storage-by-value behavior, and unique characteristics shape how JavaScript operates and interacts with data, making a strong understanding of primitives foundational for JavaScript development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89f9dca8f05e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Var, Let, Const: The Holy Trinity of JavaScript Variable Declarations ]]></title>
            <link>https://medium.com/@samidsyed1720/var-let-const-the-holy-trinity-of-javascript-variable-declarations-7bb2b09011b9?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bb2b09011b9</guid>
            <category><![CDATA[variables]]></category>
            <category><![CDATA[var]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[const]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 06:35:16 GMT</pubDate>
            <atom:updated>2024-10-29T06:55:12.630Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>In JavaScript, variables are a way to store data values that can be used and manipulated throughout your code. There are three ways to declare a variable: var, let, and const.</li></ol><p><strong>1. let</strong>: The let keyword in JavaScript is a modern way to declare variables, introduced with ES6 (ECMAScript 2015). It addresses some of the issues associated with the older var keyword, such as scoping behavior and redeclaration quirks.</p><p><strong>eg: Redeclare</strong>: You can’t redeclare a <strong>let</strong> variable within the same scope. Attempting to do so will result in an error.</p><pre>let name = &quot;samid&quot;;<br>let name = &quot;syed&quot;; // Error: Identifier &#39;name&#39; has already been declared<br>console.log(name);</pre><p><strong>e.g.,</strong> <strong>Reassign</strong>: While <strong>let</strong> doesn’t allow redeclaration, it does allow reassignment of values within its scope.</p><pre>let age = 25;<br>age = 26; // This is allowed<br>console.log(age); // Output: 26</pre><p><strong>2. var: </strong>The var keyword in JavaScript is the original way to declare variables. While still used, it’s generally recommended to use let and const for new JavaScript code, as var has some quirks that can lead to unintended behavior.</p><p>e.g., <strong>Redeclare</strong>: Variables declared with <strong>var</strong> can be redeclared within the same scope without any error</p><pre>var name= 5;<br>var name= 10;<br><br>var z = x + y;<br>console.log(z); //15</pre><p>eg: <strong>Reassign: </strong>This can sometimes lead to accidental overwrites if a variable name is used multiple times.</p><pre>var name = &quot;syed&quot;;<br>var name = &quot;samid&quot;; // Allowed: name is redeclared with &quot;samid&quot;<br>console.log(name); // Output: samid</pre><p><strong>3. const</strong>: The const keyword in JavaScript is used to declare variables that are meant to remain constant, meaning their values cannot be reassigned after they are set.</p><p>eg: <strong>Redeclare</strong>: Variables declared with <strong>const</strong> cannot be redeclared in the same scope, and they cannot be reassigned to a new value after their initial assignment.</p><pre>const a = 10;<br>const a = 20;<br><br>console.log(a);</pre><p>eg: <strong>Reassigne: </strong>This is because <strong>const</strong> prevents reassignment of the variable itself but does not prevent modifications to the data the variable points to</p><pre>const a = 10;<br>a = 20;<br>console.log(a)</pre><p>When to use let and when to use const:</p><pre>Feature:          let                                     const<br><br>Reassignment:     Allowed                                 Not allowed<br>        <br>Scope:            Block-scoped                            Block-scoped<br><br>Best Use Case    Variables that need to change            Immutable or Reference Values</pre><p><strong>Conclusion</strong>: Understanding when to use var, let, or const can save you from unexpected behavior in your code. As a rule of thumb, lean towards const and let, and reserve var for legacy code if necessary.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bb2b09011b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript vs. Node.js: What They Are and How They Power the Web]]></title>
            <link>https://medium.com/@samidsyed1720/javascript-vs-node-js-what-they-are-and-how-they-power-the-web-e5cf1173c4f0?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5cf1173c4f0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 14:20:23 GMT</pubDate>
            <atom:updated>2024-10-28T14:20:23.868Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MSxj50TwvE9iaW9G" /></figure><h3>History of javascript</h3><p>javaScript also known as ECMA script, was created by Brendan Eich while working at Netscape Communication. Originally named ‘<strong>Mocha</strong>,’ it was quickly renamed ‘<strong>LiveScript</strong>’ and eventually to ‘JavaScript’ to capitalize on Java’s popularity. Despite the name, JavaScript is distinct from Java, with a syntax loosely based on C, but it’s a lightweight, dynamically-typed scripting language designed to make web pages interactive.</p><p>In the mid-1990s, JavaScript was gaining traction as a popular language for web interactivity, but differences in implementations were creating challenges for developers. Netscape (the original creator of JavaScript) and Microsoft (which created its own version called JScript) worked with the European Computer Manufacturers Association (ECMA) to standardize the language, creating ECMAScript 1 (ES1) in 1997. This standard defines core syntax, functions, and language structure.</p><p>Versions of ESL was launched in 1997, they are:<br><strong>ES5</strong> : 2009<br><strong>ES6 </strong>: 2015 (Biggest Update of JS in History)<br><strong>ES7</strong> : 2016<br><strong>ES8</strong> : 2017w</p><p>ECMAScript’s is predominantly used for making web pages interactive, such as form validation and animations, but known as ECMA Scrip is also used in other areas. Such as server-side development, mobile app developers, and many more. Desktop app development. Because of its wide range of applicaitions you can run JavaScript in several ways</p><h3>The JavaScript Engine and Runtime</h3><p><strong>JavaScript Engines</strong>: A JavaScript engine is a program that executes JavaScript code. Examples include Google Chrome’s V8, Firefox’s SpiderMonkey, and Microsoft’s Chakra. These engines convert JavaScript into optimized machine code, allowing high performance.<br><strong>Runtime Environments</strong>: JavaScript’s primary runtime environment is the web browser, where engines interpret JavaScript code. Node.js provides an additional runtime, allowing JavaScript to run on servers and interact with the file system, network, and databases.</p><h3>History of NodeJS</h3><p>Node.js is an open-source, cross-platform runtime environment that enables JavaScript to be used on the server side. It is a free, open source, cross-platform javascript runtime environment that lets developers write command line tools and server-side script outside of the browsers</p><p>The latest version of Node is v23.1.0 (current)</p><p>LTS is v20.18.0</p><p>Developed by Ryan Dahl in 2009, Node.js has grown into one of the most popular tools for backend development. It’s built on Google Chrome’s V8 JavaScript engine, which compiles JavaScript directly into machine code, allowing Node.js to deliver high performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XtNdRk6y9X5hEf-t.png" /></figure><p><strong>NPM (Node Package Manager):</strong></p><p>Node.js comes with <strong>NPM</strong>, the largest software registry globally, which hosts over a million packages. These packages provide pre-built solutions for various functionalities, such as database connection, authentication, and file handling, significantly speeding up development.</p><p><strong>Cross-platform compatibility:</strong></p><p><strong>Node.js</strong> can run on major operating systems, including Windows, macOS, and Linux. Additionally, Node.js applications can be developed on one platform and deployed on another with minimal adjustments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5cf1173c4f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding 1’s Complement and 2’s Complement]]></title>
            <link>https://medium.com/@samidsyed1720/understanding-1s-complement-and-2-s-complement-eab4e7df0d67?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/eab4e7df0d67</guid>
            <category><![CDATA[numbers]]></category>
            <category><![CDATA[number-system]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Fri, 25 Oct 2024 02:16:49 GMT</pubDate>
            <atom:updated>2024-10-25T02:16:49.980Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*43F-ITYwD0ltj65D" /></figure><p>If you’ve ever delved into the world of computer science or digital electronics, you’ve probably come across the terms “1’s complement” and “2’s complement.” These terms may sound intimidating, but they are essential concepts used in representing signed numbers in binary systems. In this blog, we’ll break down these concepts, explain how they work, and why they matter.</p><h3>1. 1’s complement</h3><p>The binary numbers can be easily converted into the 1’s complement with the help of a simple algorithm. According to this algorithm, if we toggle or invert all bits of a binary number, the generated binary number will become the 1’s complement of that binary number. That means we have to transform 1 bit into the 0 bit and 0 bit into the 1 bit in the 1’s complement. N’ is used to indicate the 1’s complement of a number.<br><strong>Example</strong>: Here, we will assume that the number is stored with the help of 4 bits.</p><pre>Let numbers be stored using 4 bits<br><br>2&#39;s complement of 7 (0111) is 9 (1001)<br>2&#39;s complement of 12 (1100) is 4 (0100) </pre><h3>2. 2’s complement</h3><p>Understanding 2’s complement after understanding unsigned binary representation is very easy. 2’s complement is just a method to represent negative numbers in addition to positive numbers.</p><pre>2&#39;s complement of &quot;0111&quot; is &quot;1001&quot;<br>2&#39;s complement of &quot;1100&quot; is &quot;0100&quot; </pre><p>In 2’s complement representation, we look at the first digit of the binary number to determine if it is positive or negative. If the number is position, the number will start with 0. If the number is negative, the number will start with 1.</p><p>However, there IS a specific procedure to convert the numbers. For example, 11111 in 2’s complement is -1 (decimal), not -15 or -31. This is to make addition, subtraction, and even multiplication possible with 2’s complement.</p><p>Note that while 2’s complement can hold the same amount of numbers as ordinary binary representation (2ⁿ numbers with n digits), the numbers stored are always smaller than normal binary representation. Recall that using 5 digits, you can represent 00000 to 11111 (0 to 31). Using 2’s complement and 5 digits, you can only represent 10000 to 01111 (-16 to 15).</p><p><strong>2’s Complement to Decimal</strong><br>To convert a 2’s complement representation into a readable number format, follow these steps:</p><ol><li>If the number is positive (the most significant bit is 0), convert the number into decimal format normally.</li><li>If the number is negative, flip all the digits in the number. In other words, change all the 1’s to 0’s and all the 0’s to 1&#39;s.</li><li>Add 1 to the flipped number.</li><li>To see the number in decimal format, just convert it to a decimal number like in regular binary representation.</li></ol><p>For example, let’s convert 10110110.</p><ol><li>Since the most significant bit is 1, we need to flip the digits in the number.</li><li>10110110 → 01001001.</li><li>Add 1 to the number. 01001001+1=01001010.</li><li>01001010 (binary) = 74 (decimal).</li><li>So, 10110110 (2’s complement)=-74 (decimal).</li></ol><p>Decimal to 2’s Complement<br>If we implement the steps from the previous part but in reverse, we can convert a decimal number into a 2’s complement representation.</p><ol><li>If the number is positive, convert the number to binary representation normally. Make sure the binary number’s most significant digit is 0, because the number is positive.</li><li>If the number is negative, convert the number to a binary representation as if it were a positive number.</li><li>Subtract the number by 1.</li><li>Flip all the digits in the number.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eab4e7df0d67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Command-Line Tools for Web Downloads wget and curl]]></title>
            <link>https://medium.com/@samidsyed1720/command-line-tools-for-web-downloads-wget-and-curl-170e9cdc4338?source=rss-d4305b57be46------2</link>
            <guid isPermaLink="false">https://medium.com/p/170e9cdc4338</guid>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[wget]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[curl]]></category>
            <dc:creator><![CDATA[Syed Samid Saud]]></dc:creator>
            <pubDate>Mon, 21 Oct 2024 11:40:49 GMT</pubDate>
            <atom:updated>2024-10-21T11:40:49.611Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fYQm-KoYDb2Rg2nV" /></figure><p>When it comes to downloading files from the web, two command-line tools dominate the landscape <strong>wget</strong> and <strong>curl</strong>. Both are immensely powerful, versatile, and highly useful for automating downloads, retrieving content, and interacting with web servers. Though they are often used interchangeably, they each have unique features and capabilities that suit different use cases. In this blog post, we’ll explore the differences between wget and curl, along with their most common options, variations, and when you might want to use one over the other. So, if you just want to download a file, <strong>wget</strong> is a good choice. But if you need to do something more complicated, <strong>curl</strong> might be better. Both tools are very helpful for downloading things from the internet!</p><h3>Common Usage Examples of Wget</h3><p>1. Simple File Download:<br><strong>wget </strong><a href="http://example.com/file.zip"><strong>U</strong></a>RL<br>Downloads a file from the provided URL.</p><p>2. Download to a Specific File Name:<br><strong>wget -O custom_name.zip </strong><a href="http://example.com/file.zip"><strong>U</strong></a>RL<br>Saves the downloaded file as custom_name.zip.</p><p>3. Resume Interrupted Download:<br><strong>wget -c </strong><a href="http://example.com/file.zip"><strong>U</strong></a>RL<br>It continues the downloading of the file from where it was left off if the connection was interrupted.</p><p>4. Download Entire Website:<br><strong>wget — mirror -p — convert-links -P ./local-dir </strong><a href="http://example.com"><strong>U</strong></a>RL<br>This command will mirrors an entire website for offline viewing:</p><p>— mirror: Enables options for mirroring.<br>-p: Downloads all necessary files for proper display.<br> — convert-links: Converts links so that the mirrored website can be viewed offline.<br>-P ./local-dir: Saves the downloaded site to <strong>local-dir</strong>.</p><p>5. Download in Background:<br><strong>wget -b </strong><a href="http://example.com/file.zip"><strong>U</strong></a>RL<br>Downloads the file in the background, writing progress to a log file.</p><p>6. Limit Download Speed:<br><strong>wget — limit-rate=100k URL</strong><br>Limits the download speed to 100 KB/s.</p><p>7. Recursive Download (multiple levels of pages):<br><strong>wget -r </strong><a href="http://example.com/"><strong>U</strong></a>RL<br>Downloads the entire directory structure recursively.</p><p>8. Download Files via FTP:<br><strong>wget ftp://username:password@ftp.example.com/file.zip</strong><br>Allows downloading files from an FTP server, optionally using a username and password.</p><p>9. Download All Files of a Certain Type:<br><strong>wget -r -A ‘*.jpg’ </strong><a href="http://example.com/images"><strong>U</strong></a>RL<br>Recursively download all files with the .jpg extension from the specified directory.</p><p>10. Set Number of Retries for Download</p><p><strong>wget — tries=10 </strong><a href="http://example.com/file.zip"><strong>U</strong></a>RL<br>Retries up to 10 times before giving up on the download.</p><p>11. Continue Downloading Even After a 404 Error:<br><strong>wget — ignore-errors </strong><a href="http://example.com/files"><strong>U</strong></a>RL<br>Ignores 404 errors and continues downloading the remaining files.</p><p><strong>Popular wget Options:</strong></p><ul><li>V, — version: Display the version of wget</li><li>-h, — help: Print a help message listing available options.</li><li>-O file: Save the downloaded content to the specified file (instead of the default filename).</li><li>-o logfile: Write the output messages to the specified file (log).</li><li>-q, — quiet: Run in quiet mode (no output).</li><li>-nv: Show fewer output messages (non-verbose).</li><li>— no-check-certificate: Skip certificate validation when downloading over HTTPS.</li><li>-c, — continue: Continue downloading a partially downloaded file</li><li>-b, — background: Run wget in the background after starting.</li><li>--limit-rate=amount: Limit download speed (e.g., — limit-rate=100k)</li><li>-r, — recursive: Download recursively (useful for downloading entire websites).</li><li>-l depth, — level=depth: Set the recursion depth level (works with -r).</li><li>-np: Same as — no-parent.</li><li>— random-wait: Wait for a random amount of time between downloads to avoid being throttled.</li><li>— wait=seconds: Wait for the specified number of seconds between retrievals.</li><li>-t number, — tries=number: Set the number of retries for failed downloads.</li><li>— header=header: Send a custom HTTP header with the request.</li><li>— user=username — password=password: Provide HTTP authentication credentials.</li><li>— post-data=data: Send data using HTTP POST method.</li><li>-method=method: Use a custom HTTP method (like PUT, DELETE, etc.).</li><li>— ftp-user=user — ftp-password=password: Provide FTP authentication credentials.</li><li>— no-remove-listing: Do not remove .listing files generated by FTP downloads</li></ul><h3>What Is CURL</h3><p><strong>curl</strong> allows you to interact with URLs and send requests to servers directly from the command line. It retrieves or uploads data using supported protocols, making it a versatile tool for automation, testing APIs, or simply downloading web content.</p><h3>Common curl Options:</h3><p><strong>1. Downloading Files</strong><br>1.1 To save it to a file, you can use the -o option:<br><strong>curl -o </strong><a href="https://example.com">U</a>RL<br>1.2 If you want to keep the original filename, use -O (uppercase):<br><strong>curl -O </strong><a href="https://example.com/file.zip">U</a>RL</p><p><strong>2. Custom Headers</strong><br>2.1 You can use custom headers with the -H option, which is useful for API requests:<br> <strong>curl -H “Authorization: Bearer &lt;token&gt;” </strong>URL</p><p><strong>3. HTTP Methods</strong><br>3.1 POST request with data:<br><strong>curl -X POST -d “name=John&amp;age=30” </strong>URL<strong> </strong><br>3.2 You can send JSON data using the -d flag and specifying the content type:<br><strong>curl -X POST -H “Content-Type: application/json” -d ‘{“name”:”John”, “age”:30}’ </strong>URL<br>3.3 PUT and DELETE work similarly:<br><strong>curl -X PUT -d ‘{“name”:”Jane”}’ </strong>URL<strong><br>curl -X DELETE </strong><a href="https://example.com/api/users/1">U</a>RL</p><p><strong>4. Authentication</strong><br>4.1 If you need to authenticate with a username and password, you can use -u:<br><strong>curl -u username:password </strong><a href="https://example.com/secure-data">U</a>RL</p><p><strong>5. Follow Redirects</strong><br>By default, cURL won’t follow HTTP redirects. To enable this, use the -L option:<br><strong>curl -L </strong>short_URL</p><p><strong>6. Verbose Mode</strong><br>For debugging purposes, you can use -v to see detailed information about the request and response:<br><strong>curl -v </strong>URL<br>For even more information (including headers), use — trace:<br><strong>curl — trace trace.log </strong>URL</p><p><strong>7. Timeouts</strong><br>If you need to limit the time cURL waits for a response, you can set a timeout:<br><strong>curl — max-time 10 </strong>URL</p><p><strong>8. Resume Downloads</strong><br>If a download was interrupted, you can use the -C option to resume it:<br><strong>curl -C — -O </strong>URL</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=170e9cdc4338" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>