Factory Function in JavaScript (Hindi)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 58

  • @sachingoel9866
    @sachingoel9866 3 ปีที่แล้ว +1

    I am using it from very long time but maze ki bat ye hai mujhe ab pata chala factory function hota kya hai or hum isse kyu use karte hai :-

  • @muhammadnaveed7953
    @muhammadnaveed7953 3 ปีที่แล้ว

    LOve U Sir g,,,, Aap Ka jawab nahi hai. Unique Teacher in the entire World.

  • @anitaprusty5019
    @anitaprusty5019 2 ปีที่แล้ว

    Amazing video 👏👏

  • @syedmuhammadammad558
    @syedmuhammadammad558 5 ปีที่แล้ว +4

    sir please explain difference between Object and Object instance?

  • @rahulnarhe9392
    @rahulnarhe9392 5 ปีที่แล้ว +1

    please explain callback,promise and observable also..it will be very helpful

  • @codingki7826
    @codingki7826 ปีที่แล้ว

    Jabardast sir jii

  • @prementerprises3358
    @prementerprises3358 4 ปีที่แล้ว

    I am in London and you are superub

  • @avkexpress8029
    @avkexpress8029 6 ปีที่แล้ว +1

    owsm sir you are great

  • @NaveenRawat51
    @NaveenRawat51 6 ปีที่แล้ว

    you nailed it. awesome video.

  • @nirajkumardangi
    @nirajkumardangi 9 หลายเดือนก่อน

    thnaks broo

  • @raheelsiddique1631
    @raheelsiddique1631 4 ปีที่แล้ว +1

    Sir is this like as constructor function. ?

  • @jabidp7595
    @jabidp7595 4 ปีที่แล้ว

    Just awesome

  • @Web_Developer09
    @Web_Developer09 11 หลายเดือนก่อน

    Sir ik acha web developer bnny ka lia kia kia seekhna chaheya important languages aur framework suggest ker da please
    Mujhy guidence ki zarurat ha

    • @geekyshows
      @geekyshows  11 หลายเดือนก่อน

      Watch this th-cam.com/video/clsulVp3vHA/w-d-xo.html

  • @wildturtle2416
    @wildturtle2416 4 ปีที่แล้ว

    Actually the function is simply returning an object and we are assigning it into a variable and then we use that variable to access all the key value pairs of that object simple -.-

    • @finncallan1087
      @finncallan1087 3 ปีที่แล้ว

      pro trick : you can watch series at Flixzone. Me and my gf have been using them for watching a lot of movies lately.

    • @zahirbyron1195
      @zahirbyron1195 3 ปีที่แล้ว

      @Finn Callan Yea, I've been watching on flixzone for years myself :D

    • @yosefreese133
      @yosefreese133 3 ปีที่แล้ว

      @Finn Callan yea, have been using flixzone for months myself =)

  • @funtravellers7754
    @funtravellers7754 6 ปีที่แล้ว

    Awesome Bro...

  • @the.renish.salakhana
    @the.renish.salakhana 2 ปีที่แล้ว

    what if prices are different for different model ??
    do write like this add MRP argument/parameter :
    function mobile(model_no,MRP){
    return { model:model_no,
    price:MRP
    };
    };

  • @kamsyd13
    @kamsyd13 4 ปีที่แล้ว +1

    whats the difference between factory function & constructor function??
    please reply

    • @sumitnaiyaa
      @sumitnaiyaa ปีที่แล้ว

      Its just two ways of creating function. Nothing else

  • @syedmuhammadammad558
    @syedmuhammadammad558 5 ปีที่แล้ว +1

    sir Object instance or Object me kia main difference ha?

  • @AdeelKhan-ez3ij
    @AdeelKhan-ez3ij 3 ปีที่แล้ว

    Sir, it's not working and shows uncaught syntax error in the anonymous function line but still i can't find the error

  • @Niamat-w9s
    @Niamat-w9s 6 ปีที่แล้ว

    thanks

  • @SabitaShyam
    @SabitaShyam 11 หลายเดือนก่อน

    Factory Function in JavaScript
    function mobile(){
    return {
    model: "Galaxy",
    price: function(){
    return "Price is Rs.3400";
    }
    };
    }
    var samsung= mobile();
    document.write("Price is "+samsung.price());
    document.write(" Price is "+samsung.model);

  • @waqasawan1626
    @waqasawan1626 4 ปีที่แล้ว

    sir factory funcation ky ander jo funcation ha is me parameter add kr ky us ko kesy acess kryan gy

  • @sawaimalhi8439
    @sawaimalhi8439 6 ปีที่แล้ว

    wa sir kya baat hai

  • @aaradhyavajpayee2306
    @aaradhyavajpayee2306 3 ปีที่แล้ว

    how to change mobile price dynamically.
    please suggest me.

  • @milanpoudel3737
    @milanpoudel3737 4 ปีที่แล้ว +1

    Bro how come atfer using factory function ,document.write(samsung.model) = 'Galaxy' of mobile when i type document.write(mobile.model) it doesn't give me anthing

    • @story-stacks
      @story-stacks 4 ปีที่แล้ว

      same to my code it doesnot work!!

    • @milanpoudel3737
      @milanpoudel3737 4 ปีที่แล้ว

      @@story-stacks its not that the code doesn't work but I didn't understand the logic....I mean the javascript logic behind that

    • @story-stacks
      @story-stacks 4 ปีที่แล้ว

      @@milanpoudel3737 as much i understood about this logic is : you can create multiple object instances and just access your properties. now when ur using constructor object u were creating properties name / key for every object . the problem was key/properties ko code was repeating .so just in factory function u create object instances and u acess properties using it .(no need to write key for every object)

  • @sagarraut4229
    @sagarraut4229 5 ปีที่แล้ว +1

    hello dear i hav an error .. Uncaught SyntaxError: Unexpected token ' : ' in " price : "
    function mobile(model_no)
    {
    return
    {
    model: model_no,
    price : function()
    {
    return "Price is Rs. 300";
    }
    };
    }
    please tell me how to solve

    • @syedmuhammadammad558
      @syedmuhammadammad558 5 ปีที่แล้ว +3

      return ka body tag same line se start hoga
      function mobile(model_no)
      {
      return{
      model: model_no,
      price: function(){return "Price is Rs. 300";}
      }
      }

    • @RealDeepak
      @RealDeepak 5 ปีที่แล้ว

      Yes, Ammad is correct.
      You need to start your left curly braces "{" from same return line. Like " return { "
      Bottom is the solution:
      function mobile(model_no) {
      return {
      model: model_no,
      price: function() {
      return "Price is Rs. 300";
      }
      };
      }
      var lg = mobile("lg 101");
      console.log(lg.model + ' and ' + lg.price());

    • @sunielnehra
      @sunielnehra 5 ปีที่แล้ว

      quit programming. start pani puri thela

  • @deepgoplani9921
    @deepgoplani9921 5 ปีที่แล้ว

    Sir, you have explained all the single topics in detail but you have never explained why we use the anonymous function. may you give me an answer, please?

    • @geekyshows
      @geekyshows  5 ปีที่แล้ว +1

      Watch Map Method Video

  • @nayaktricksgaming
    @nayaktricksgaming ปีที่แล้ว

    But bro price change krne ke liye kya karee

  • @atul6224
    @atul6224 6 หลายเดือนก่อน

    bro agar nokia 3310 ka price diffrent hua to kaise access krenge

  • @anilmanhar940
    @anilmanhar940 5 ปีที่แล้ว +3

    Bhai app kissi ke comment ka Jawab nahi dette ho

  • @sahilrao8182
    @sahilrao8182 4 ปีที่แล้ว

    This is kinda same as a construction function.
    Shouldn't we use construction function instead

  • @kazishafin1
    @kazishafin1 5 ปีที่แล้ว

    Sir i wrote bellow code but model parameter showing "undefined " i am not getting how to correct it, Please help me. Thanks in advance
    function config(model, ram, rom)
    {
    return {
    detail: model,
    ram,rom,
    price: function() {
    return " 15000 TK";
    }
    };
    }
    var samsung = config("GalaxyJ7", "2GB", "16GB");
    document.write(samsung.model + " " + samsung.ram + " " + samsung.rom + "" );

    • @jatindahiya741
      @jatindahiya741 4 ปีที่แล้ว

      Which browser you are using?

    • @shivbaboo3491
      @shivbaboo3491 2 ปีที่แล้ว

      you have to write samsung.detail instead of .model.

  • @laxmankumar-iv2hf
    @laxmankumar-iv2hf 5 ปีที่แล้ว

    Brother ur videos r good but try to make it in English that would be helpful in interview. I am from south buddy let me learn something from you

  • @jagdishjena9058
    @jagdishjena9058 5 ปีที่แล้ว +1

    sir Nokia ka price kese change hoga?

  • @ravinsvlog6354
    @ravinsvlog6354 2 ปีที่แล้ว

    Sir model ka theek hai lekin price same hai

  • @sahilrao5677
    @sahilrao5677 4 ปีที่แล้ว

    *ok*

  • @jigarzanzarukiya4892
    @jigarzanzarukiya4892 5 ปีที่แล้ว

    Same code is not working in chrome.
    Any suggestions...

    • @mdomarfaruk3311
      @mdomarfaruk3311 5 ปีที่แล้ว

      function mobile (a )
      {
      return {
      Model: a,
      Price: function ()
      {
      return "Price = 3000";
      }
      };
      }
      var samsung = mobile ( 'Galaxy' );
      document.write (samsung.Model + " " + samsung.Price () + "");
      var nokia = mobile ( '1200' );
      document.write (nokia.Model + " " + nokia.Price () );

  • @kesharipratap9928
    @kesharipratap9928 6 ปีที่แล้ว

    Sir css me transistion kyu nahi kam karta

  • @pratikshahajare2423
    @pratikshahajare2423 4 ปีที่แล้ว

    how can we pass multiple parameters with a factory function

    • @valentinosmith
      @valentinosmith 4 ปีที่แล้ว

      //Factory Function with multiple parameters....
      function mobile(model_no,type,size,cost){
      return { //it is returning the below object
      model: model_no,
      make: type,
      ram: size,
      price: cost
      };
      }
      var samsung = mobile('galaxy','S3','4GB',20000);
      var nokia = mobile('nokia','3310','1GB',10000);
      var apple = mobile('iphone','10','4GB',70000);
      console.log(samsung);
      console.log(nokia);
      console.log(apple);

  • @asadullahbappi3763
    @asadullahbappi3763 4 ปีที่แล้ว +2

    I didn't understand a single second of this video. Needed more examples. Also what I see in all youtube tutorials there is no example related to web development. All tutorials are only explaining codes

  • @mart542
    @mart542 4 ปีที่แล้ว

    Sir, it's not working and shows uncaught syntax error in the anonymous function line but still i can't find the error.