Javascript Variables in Hindi- जावास्क्रिप्ट वेरिएबल्स क्या है हिंदी में

0
74
javascript-variables
84 / 100

Hello friends aaj ki is post me ham dekhne wale hai javascript variables in hindi javascript me variables ko memory reference ke liye use kiya jaata hai kisi bhi programming language mai variables ko memory or Memory name ke roop mai use kiya jaata hai or ham ye bhi keh sakte hai ye variable values or data ko memory me store Karta hai.

Java script variables ko kaise use kare [javascript variables in hindi ]

java script variable ko use karne ke liye javascript me Reserved keyword hai jisko use karke ham javascript varibales ko use kar sakte hai chalo dekhte hai ki wo konse keyword hai javascript mai
hamare pass three types ke keywords hai jinko ham javascript mai as a keyword use kar sakte hai
javascript variables in hindi
javascript variables in hindi

 

  1. Var Keyword:

var ko ham initialize declare or render(assign) , shadowing or hoisting kar sakte hai.

x=10;  ——Assigning(Rendering Value)
assigning means ham variable ko value assign kar rahe hai
var x=10;—–Initialization
initialization means ham variable ko declare time value assign kar rahe hai.
var x;      Declaring
declare means just ham varibale memory name X ko declare kar rahe hai use karne ke liye.
Shadowing:
  • shadowing means same name indetifier ko agar ham redeclare karte hai context ke under tab is process ko shadowing kaha jaata hai.
  • var keyword ko function scope variable kaha jaata hai.
  • only var keyword shadowing ko allow karta hai hai.
  • agar ham shadowing ko use karte hai tab ham hamari purani value replace hokar new value store ho jaati memory mai.
Example:-
 
<!DOCTYPE html>
<html>
    <head>
        <script>
            var x=10;
            var x=20; // Shadowing Bcz redeclaration of X //
 
            document.write(x);
        </script>
    </head>
</html>
 
 
Hoisting:
  • var allows shadowing Iska Matlab ham variable ki memory ko use Karne ke baad usko declare kar sakte hai only ye var allows Karta hai other variable keyword nahi.
Example: 
  <script>
    “use strict”;
    function f1() {
        x=10;
        document.write(“x=” + x);
        var x;  // x is hoisted by var
    }
    f1();
</script>  
 

 

Let Keyword:

  • let keyword allows Declaration , rendering or initialization
  • let keyword Shadowing allow nahi karta hai hai.
  • let keyword ko Block scope varibale kaha jaata hai.
  • let ko ham hoist nahi kar sakte hai.
let x=10;          Initialize 
 
let x;                 Declaration
 
x=10;                Rendering 
 
Ex:
 
<script>
    “use strict”;
    function f1() {
        var x;
        x=10;
        if(x==10) {
            let y;
            y=20;
        }
        document.write(“x=” + x + “<br>” + “y=” + y);
// error: y not defined
    }
    f1();
</script>

Const Keyword:

  • Const bhi Block Scope variable hai.
  •  Const   ko ham only Initialize kar sakte hai.
  • Const declaration or Rendering Allow nahi karta hai .
  • Const Shadowing allow nahi karta hai.
Ex:
<script>
    “use strict”;
    function f1() {
       const x = 10;
       document.write(“x=” + x);
    }
    f1();
</script>

Conclusion:-

agar aapko hamari ye variable se related post pasand aai ho tou jarror share kiliye agar aapko kisi prakaar ki problem aati hai is code example ko run karne aap hame comment box mai comment kar sakte hai ham aapki jaroor help karnenge dhanyawaad.

LEAVE A REPLY

Please enter your comment!
Please enter your name here