<?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: Shrashti Sharma</title>
    <description>The latest articles on DEV Community by Shrashti Sharma (@shrashti06702008).</description>
    <link>https://dev.to/shrashti06702008</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4192768%2F48fad205-401d-4253-86ad-92da6ab2c1d5.png</url>
      <title>DEV Community: Shrashti Sharma</title>
      <link>https://dev.to/shrashti06702008</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shrashti06702008"/>
    <language>en</language>
    <item>
      <title>JavaScript From Scratch: Learning One Concept at a Time</title>
      <dc:creator>Shrashti Sharma</dc:creator>
      <pubDate>Tue, 20 Oct 2026 10:33:56 +0000</pubDate>
      <link>https://dev.to/shrashti06702008/javascript-from-scratch-learning-one-concept-at-a-time-1gdf</link>
      <guid>https://dev.to/shrashti06702008/javascript-from-scratch-learning-one-concept-at-a-time-1gdf</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                        TITLE - the start 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;okay so since these are just my blogs , so obviously gonna be so informal but informative so let's begin&lt;/p&gt;

&lt;p&gt;JavaScript can be categorized into &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DATATYPE : &lt;/li&gt;
&lt;li&gt;number&lt;/li&gt;
&lt;li&gt;string&lt;/li&gt;
&lt;li&gt;Boolean&lt;/li&gt;
&lt;li&gt;array&lt;/li&gt;
&lt;li&gt;object&lt;/li&gt;
&lt;li&gt;undefined&lt;/li&gt;
&lt;li&gt;Big int&lt;/li&gt;
&lt;li&gt;symbol&lt;/li&gt;
&lt;li&gt;null&lt;/li&gt;
&lt;li&gt;function&lt;/li&gt;
&lt;li&gt;VARIABLE&lt;/li&gt;
&lt;li&gt;let&lt;/li&gt;
&lt;li&gt;const&lt;/li&gt;
&lt;li&gt;var&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  "npm" - it is used here to include the header files.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  nod- resonates the g++ of cpp
&lt;/h1&gt;

&lt;h1&gt;
  
  
  JS is a weakly typed than cpp and java they both are dynamically typed ab ye kya hta h dekhte hn-
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;dynamically typed - &lt;br&gt;
aesi languages jinme datatype agar ek baar define kr diya to uske liye alotted memory box k size becomes fixed now you cannot enter any other datatype in that specified space, ok. for eg:&lt;br&gt;
int a = 10 &lt;br&gt;
//in cpp int is provided 32 bits memory so it's fixed , u can't be entering double in it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;weakly typed- &lt;br&gt;
javascript is weakly typed kiuki usme there is variable size matlab you could have made a variable a with no datatype at all and enter any datatype to it. for eg:&lt;br&gt;
input-&amp;gt;&lt;br&gt;
a='hello';&lt;br&gt;
console.log(a) ;&lt;br&gt;
a= 1.11;&lt;br&gt;
console.log(a);&lt;br&gt;
output-&amp;gt;&lt;br&gt;
hello&lt;br&gt;
1.11&lt;br&gt;
//yhn 'a' took both the datatype values without any issue lekin cpp m krte to error aa jata&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;# how to print in javascript:&lt;br&gt;
console.log();&lt;/p&gt;

&lt;h1&gt;
  
  
  for loop k syntax dekh lete hn isme:
&lt;/h1&gt;

&lt;p&gt;input-&amp;gt;&lt;br&gt;
a='hello';&lt;br&gt;
for(let i=0;i
  console.log(a[i]);&lt;br&gt;
}&lt;br&gt;
output-&amp;gt;&lt;br&gt;
h&lt;br&gt;
e&lt;br&gt;
l&lt;br&gt;
l&lt;br&gt;
o&lt;br&gt;
ab dekho isme kya hta h ki auto hi new line add ho jati h to usko avoid kene k liye we could&lt;br&gt;
input-&amp;gt;&lt;br&gt;
let x="";&lt;br&gt;
for(let i=0;i
  x += a[i];&lt;br&gt;
}&lt;br&gt;
console.log(x);&lt;br&gt;
output-&amp;gt;&lt;br&gt;
hello&lt;/p&gt;

&lt;h1&gt;
  
  
  while loop b dekh hi lete hain
&lt;/h1&gt;

&lt;p&gt;input-&amp;gt;&lt;br&gt;
let i=0;&lt;br&gt;
while(i&amp;lt;a.length){&lt;br&gt;
    console.log(a);&lt;br&gt;
    i++;&lt;br&gt;
}   &lt;/p&gt;

&lt;p&gt;output-&amp;gt;&lt;br&gt;
hello&lt;/p&gt;

&lt;h1&gt;
  
  
  Use strict : this is something that mandates you to declare your variable matlab iski vjh s ab humari language thdi discipline m aati h aur uspe restriction ho jati h ki yuhin kuch b variable na ho bina bataye for eg:
&lt;/h1&gt;

&lt;p&gt;a=10 //error&lt;br&gt;
let a =10 // ye chlega kiuki tumne bataya ye varibale h ek type k&lt;/p&gt;

&lt;h1&gt;
  
  
  arrays (heterogenous type) : idhr python ki list ki trh mamla h koi b datatype h zoo m h . for eg:
&lt;/h1&gt;

&lt;p&gt;input-&amp;gt;&lt;br&gt;
let arr = [1, 2, 3, 4, 5];&lt;br&gt;
console.log(arr);   //simply print ho jayegi&lt;br&gt;
arr = ['a', 1.11, true, null];&lt;br&gt;
console.log(arr);   //simply print ho jayegi&lt;br&gt;
for(let i=0;i&amp;lt;arr.length;i++){&lt;br&gt;
    console.log(arr[i]);&lt;br&gt;
}                   // arrays k element p iterate krenge&lt;br&gt;
arr[10]= 'random';  //koi b index p value de skte hn&lt;br&gt;
console.log(arr);   // jin indexes m value ni hgi udhr undefined aayega&lt;br&gt;
for(let i of arr){&lt;br&gt;
    console.log(i); //yhn 'of' keyword ki help s b iterate kr skte hn&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;output-&amp;gt;&lt;br&gt;
[ 1, 2, 3, 4, 5 ]&lt;br&gt;
[ 'a', 1.11, true, null ]&lt;br&gt;
a&lt;br&gt;
1.11&lt;br&gt;
true&lt;br&gt;
null&lt;br&gt;
[ 'a', 1.11, true, null, &amp;lt;6 empty items&amp;gt;, 'random' ]&lt;br&gt;
a&lt;br&gt;
1.11&lt;br&gt;
true&lt;br&gt;
null&lt;br&gt;
undefined&lt;br&gt;
undefined&lt;br&gt;
undefined&lt;br&gt;
undefined&lt;br&gt;
undefined&lt;br&gt;
undefined&lt;br&gt;
random&lt;/p&gt;

&lt;h1&gt;
  
  
  object : it is like a collection of key value pair used to store the related information together
&lt;/h1&gt;

&lt;p&gt;for eg:&lt;br&gt;
input-&amp;gt;&lt;br&gt;
let obj = {&lt;br&gt;
    name: 'John',&lt;br&gt;
    age: 30,&lt;br&gt;
    isStudent: true,&lt;br&gt;
}                         // name is key and john is it's value&lt;br&gt;
console.log(obj);&lt;br&gt;
console.log(obj.name);    // this prints the pair together&lt;br&gt;
console.log(obj['age']);  // this calls for the value at that key&lt;br&gt;
for(let key in obj){&lt;br&gt;
    console.log(key + ': ' + obj[key]);&lt;br&gt;
}&lt;br&gt;
output-&amp;gt;&lt;br&gt;
{ name: 'John', age: 30, isStudent: true }&lt;br&gt;
name:John&lt;br&gt;
30&lt;br&gt;
name: John&lt;br&gt;
age: 30&lt;br&gt;
isStudent: true&lt;/p&gt;

&lt;h1&gt;
  
  
  important reminder: we use,
&lt;/h1&gt;

&lt;p&gt;Dot notation: object.name — for property names that are valid identifiers.&lt;br&gt;
Bracket notation: object["first name"] — for any property name, including those with spaces.&lt;br&gt;
input-&amp;gt;&lt;br&gt;
let obj = {&lt;br&gt;
"first name":"vaibhav"&lt;br&gt;
name : 'lol'&lt;br&gt;
}&lt;br&gt;
console.log(obj."first name");  //ERROR&lt;br&gt;
console.log(obj.first name);    //ERROR&lt;br&gt;
console.log(obj["first name"]); // calls value : vaibhav&lt;br&gt;
console.log(obj.name);          //name : lol&lt;/p&gt;

&lt;h1&gt;
  
  
  random info: typescript is something that puts constraint over javascript
&lt;/h1&gt;

&lt;p&gt;-&amp;gt; it's used to access multiple features like functions, datatypes etc. from other languages like cpp etc.&lt;/p&gt;

&lt;h1&gt;
  
  
  for -in loop -&amp;gt; object specific
&lt;/h1&gt;

&lt;h1&gt;
  
  
  for - of loop -&amp;gt; array specific
&lt;/h1&gt;

&lt;p&gt;for eg:&lt;br&gt;
for(let key in obj){&lt;br&gt;
   console.log(key+':'+obj[key]);&lt;br&gt;
}&lt;br&gt;
//returns 'undefined' if the value does not exist for a key&lt;/p&gt;

&lt;h1&gt;
  
  
  function :
&lt;/h1&gt;

&lt;p&gt;input-&amp;gt;&lt;br&gt;
function add(a,b){&lt;br&gt;
   return a+b;&lt;br&gt;
}&lt;br&gt;
console.log(add(10,20));&lt;br&gt;
ans= add(20);&lt;br&gt;
console.log(ans);&lt;br&gt;
output-&amp;gt;&lt;br&gt;
30&lt;br&gt;
NAN //not a number since b was undefined&lt;/p&gt;

&lt;h1&gt;
  
  
  function as a datatype:
&lt;/h1&gt;

&lt;p&gt;let f = function subtract(a,b){&lt;br&gt;
   return (a-b);&lt;br&gt;
}&lt;br&gt;
console.log(f(56,31));&lt;br&gt;
// output-&amp;gt; 25&lt;br&gt;
function sayhello(){&lt;br&gt;
    console.log("hello");&lt;br&gt;
}&lt;br&gt;
sayhello();                // output-&amp;gt; hello&lt;br&gt;
console.log(sayhello());   // output-&amp;gt; undefined&lt;br&gt;
                           // as there was no return&lt;br&gt;
console.log(sayhello);     // output-&amp;gt; [function: sayhello]&lt;br&gt;
console.log(sayhello.tostring());&lt;br&gt;
// output-&amp;gt;&lt;br&gt;
  function sayhello(){&lt;br&gt;
     console.log("hello");&lt;br&gt;
  }&lt;br&gt;
console.log(subtract);      //output-&amp;gt; reference error&lt;br&gt;
// as once you save a function in variable you can only access it by given //variable now.. to jab call f yani variable k naam s hi hni h to function //ko subtarct naam do ya ni doesn't matter could have created -&lt;br&gt;
       let f = function (a,b){&lt;br&gt;
           return (a-b);&lt;br&gt;
       }&lt;br&gt;
//would have worked.&lt;/p&gt;

&lt;h1&gt;
  
  
  array shift unshift push pop :
&lt;/h1&gt;

&lt;p&gt;let arr;&lt;br&gt;
arr = [1,2,3,4];&lt;br&gt;
// to Update like: [0,1,2,3,4];&lt;br&gt;
arr.unshift(0);                               //o/p-&amp;gt; [ 0, 1, 2, 3, 4 ]&lt;br&gt;
// unshift to insert data at front in array&lt;br&gt;
arr.shift();                                  //o/p-&amp;gt; [ 1, 2, 3, 4 ]&lt;br&gt;
// pop at front in array&lt;br&gt;
arr.push(5);                                  //o/p-&amp;gt; [ 1, 2, 3, 4, 5 ]&lt;br&gt;
// insert at end &lt;br&gt;
arr.pop();                                    //o/p-&amp;gt; [ 1, 2, 3, 4 ]&lt;br&gt;
// pop at end&lt;br&gt;
// We can add at any index in array of js&lt;br&gt;
arr[8] = "My string"; //o/p-&amp;gt;[ 1, 2, 3, 4, &amp;lt;4 empty items&amp;gt;, 'My string' ]&lt;/p&gt;

&lt;p&gt;** Browser only understands Javascript and is used to make servers and it is important for development&lt;/p&gt;

&lt;h1&gt;
  
  
  hoisting :
&lt;/h1&gt;

&lt;p&gt;it says that the code is read twice means all the functions are scanned and took to the top of the code and then the normal code is read. Function/Variable(LHS:declaraction) is done by hoisting. for eg:&lt;br&gt;
before-&amp;gt;&lt;br&gt;
hello();&lt;br&gt;
function hello(){&lt;br&gt;
    console.log("Hello World");&lt;br&gt;
}&lt;br&gt;
output-&amp;gt;Hello World!!!!&lt;br&gt;
after-&amp;gt;&lt;br&gt;
// This is for representation purpose only&lt;br&gt;
function hello(){&lt;br&gt;
    console.log("Hello World");&lt;br&gt;
}&lt;br&gt;
// ----------------------------&lt;/p&gt;

&lt;p&gt;hello();&lt;br&gt;
// console.log(hello());&lt;br&gt;
before-&amp;gt;&lt;br&gt;
console.log(a);&lt;br&gt;
var a = 10;&lt;br&gt;
after-&amp;gt;&lt;br&gt;
var a;&lt;br&gt;
// ----------------------------&lt;br&gt;
console.log(a);   //undefined&lt;br&gt;
a = 10;&lt;br&gt;
console.log(a); //10&lt;/p&gt;

&lt;h1&gt;
  
  
  scope :
&lt;/h1&gt;

&lt;p&gt;// JS mei scope&lt;br&gt;
// Let : block scope&lt;br&gt;
// Var : functional scope&lt;br&gt;
// What is block? &lt;br&gt;
/*&lt;br&gt;
    {&lt;br&gt;
        Curly brackets are block&lt;br&gt;
    }&lt;br&gt;
&lt;em&gt;/&lt;br&gt;
/&lt;/em&gt;&lt;br&gt;
    let a = 20&lt;br&gt;
    if(a&amp;gt;10){&lt;br&gt;
        let x = -100;&lt;br&gt;
        console.log(x)&lt;br&gt;
    }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(x) // x is not defined...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;*/&lt;/p&gt;

&lt;p&gt;let a = 20&lt;br&gt;
if(a&amp;gt;10){&lt;br&gt;
    var x = -100;&lt;br&gt;
    console.log(x)&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;console.log(x)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>learning</category>
      <category>discuss</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
