Prototype Inheritance In JavaScript | JavaScript Tutorial In Hindi #30

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ย. 2024

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

  • @mohitsaud2071
    @mohitsaud2071 3 ปีที่แล้ว +62

    // Flour constructor
    function Flour(egg,bakingpowder,whitesugar){
    this.egg=egg;
    this.bakingpowder=bakingpowder;
    this.whitesugar=whitesugar;
    }
    // Slogan
    Flour.prototype.slogan= function(){
    return `This cake is the best`;
    }
    // Create an object from this constructor now
    let make= new Flour(2, 500, 7);
    console.log(make.slogan());
    // Cake
    function Cake(egg, bakingpowder, whitesugar, water, oven){
    Flour.call(this, egg, bakingpowder, whitesugar);
    this.water=water;
    this.oven=oven;
    }
    // Inherit the prototype
    Cake.prototype= Object.create(Flour.prototype);
    // Manually set the constructor
    Cake.prototype.constructor= Cake;
    let cook = new Cake(4, 500, 7, 500, 15);
    console.log(cook);

  • @patelrajkumarnareshkumar8156
    @patelrajkumarnareshkumar8156 2 ปีที่แล้ว +16

    Combining video lectures, source code & explanation can easily beat any paid courses.
    Thank you harry Bhai.

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

      can you please provide me the source code

  • @iamaniketkr
    @iamaniketkr 4 ปีที่แล้ว +10

    Best JavaScript Tutorial With Easy Explanation !
    Thankyou So Much Harry, For This Superb Content ♥️

  • @ashishsingla4697
    @ashishsingla4697 3 ปีที่แล้ว +9

    pls harry bhai REACT Pe ek series launch kro

  • @muhammadahsansardar5396
    @muhammadahsansardar5396 4 ปีที่แล้ว +13

    Harry bhai REACT JS par bhi Playlist create karena

  • @FightAgainstMathsFear
    @FightAgainstMathsFear 4 ปีที่แล้ว +3

    Great Harry Bhai 👍
    // food for cake
    function food(maida,cokopowder,sugarpowder) {
    this.maida = maida;
    this.cokopowder = cokopowder;
    this.sugar = sugarpowder;
    }
    food.prototype.bake = function() {
    return 'Choco Cake is ready';
    };
    let flour = new food('maida','coko','sugar');
    function cake(maida,cokopowder,sugarpowder) {
    //Inheritance
    food.call(this,maida,cokopowder,sugarpowder);

    }
    //Inheritance of prototype
    cake.prototype = Object.create(food.prototype);
    let chocoCake = new cake('Maida','coko','sugar');

  • @TechnicalAnkesh
    @TechnicalAnkesh 3 ปีที่แล้ว +16

    14:06 Harry bro roasted Rohan 😂😂

  • @nm_nishant
    @nm_nishant 4 ปีที่แล้ว +6

    Bhaii yrr tu to great hai, dil se❤
    I will support u if you start even paid content too

  • @MohammadASIF-hd4dm
    @MohammadASIF-hd4dm 3 ปีที่แล้ว +18

    function flour(price, type){
    this.price = price;
    this.type = type;
    }
    let cup = new flour('2000', 'Wheat');
    console.log(cup);
    function cake(price, type, flavour){
    flour.call(this, price, type);
    this.flavour = flavour;
    }
    let cupCake = new cake(2500, "Birthday Cake", "Strawberry");
    console.log(cupCake);

  • @yashdewan3633
    @yashdewan3633 3 ปีที่แล้ว +2

    // QUIZ :
    // inerit flour to make a cake :
    //ANS :
    function flour(price, quantity, brand) {
    this.price = price,
    this.quantity = quantity,
    this.brand = brand
    }
    flour.prototype.howToMakeIt = function() {
    return `refer youtube`;
    }
    let flourObj = new flour(100, 10, 'aashirwad aata');
    console.log(flourObj);
    //inheriting:
    function cake(price, quantity, flavour, brand) {
    flour.call(this, price, quantity, brand);
    this.flavour = flavour;
    }
    //inherting the prototype of flour constructor :
    cake.prototype = Object.create(flour.prototype);
    //inherting the comstructor:
    cake.prototype.constructor = cake;
    let cakeObj = new cake(1000, 1, 'butterscotch', 'homemade');
    console.log(cakeObj);

  • @ACHTech20
    @ACHTech20 4 ปีที่แล้ว +50

    Rohan das ko 2rs aur 0 years ka experience, Kya baat hai 🤣🤣🤣

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

      Personal rivalry hai bro😂

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

    please increase font size so it can visible

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

    Harry bhai top notch content👏🙏

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

    Amazing JavaScript Course on TH-cam 🥳🥳🥳🥳

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

    console.log("Quick quiz solution");
    const cakeObj = {
    flourName:"Suddh Desi Atta",
    flourPrice : 250,
    cakePrice: 500
    }
    function Flour(flourName, flourPrice){
    this.flourName = flourName;
    this.flourPrice = flourPrice;
    }
    let flour = new Flour(cakeObj.flourName, cakeObj.flourPrice);
    function Cake(flourName, flourPrice, cakeName, flavour){
    Flour.call(this, flourName, flourPrice);
    this.cakeName = cakeName;
    this.flavour = flavour;
    }
    Cake.prototype = Object.create(Flour.prototype);
    Cake.prototype.constructor = Cake;
    const birthDayCake = new Cake(cakeObj.flourName, cakeObj.flourPrice, "ButterCake","Sweet");
    console.log(birthDayCake);

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

    function flour(weight , color) {
    this.weight = weight;
    this.color = color;
    }
    function cake(color,weight,size ){
    flour.call(this ,weight,color);
    this.size = size;
    }
    let dish = new cake("white",1,"L");
    console.log(dish);

  • @manishathemahi
    @manishathemahi 2 ปีที่แล้ว +1

    function Flour(quantity) {
    this.quantity = quantity;
    }
    Flour.prototype.Create = function (name) {
    return `I am creating ${name}`;
    }
    function Cake(FlourQuantity, CreamQuantity) {
    Flour.call(FlourQuantity);
    this.CreamQuantity = CreamQuantity;
    }
    Cake.prototype = Object.create(Flour.prototype);
    Cake.prototype.constructor = Flour;
    let flour = new Flour(100);
    console.log(flour.Create('Bread'));
    let cake = new Cake(100, 50);
    console.log(cake.Create('cake'));

  • @amitkanwal1763
    @amitkanwal1763 2 ปีที่แล้ว +1

    Answering quiz after 3 years
    function Flour(itemName, timeTaken, quality){
    this.name = itemName;
    this.time = timeTaken;
    this.quality = quality;
    }
    Flour.prototype.prepare = function(){
    return `Preparing the ${this.name}`;
    }
    let flour1 = new Flour('Flour', 13, 'a3');
    console.log(flour1);
    // Creating a cake constructor
    function Cake(itemName, timeTaken, quality, quantity){
    // calling flour constructor
    Flour.call(this, itemName, timeTaken, quality);
    this.quantity = quantity;
    }
    // Inheriting the prototype
    Cake.prototype = Object.create(Flour.prototype);
    // Setting the constuctor
    Cake.prototype.constructor = Cake;
    let pinkCake = new Cake('Cake', 12, 'a1', 3);
    console.log(pinkCake);

  • @mehular0ra
    @mehular0ra 3 ปีที่แล้ว +2

    function Flour(price, type) {
    this.price = price;
    this.type = type;
    }
    function Cake(price, type, color) {
    Flour.call(this, price, type);
    this.color = color;
    }
    Cake.prototype = Object.create(Flour.prototype);
    Cake.prototype.constructor = Cake;
    const straberryCake = new Cake(2500, Strawberry, Pink);
    console.log(strawberryCake);

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

      @puneet kumar awasthi yeah correct thanks

  • @sahilsachdeva1518
    @sahilsachdeva1518 4 ปีที่แล้ว +6

    Bhai prototype bilkul bhi smjh nhi aaya

  • @Harshitsingh-jf4yu
    @Harshitsingh-jf4yu 3 ปีที่แล้ว +4

    // exercise
    function Items(eggs, whiteSugar, milk, chocolate) {
    this.eggs = eggs;
    this.whiteSugar = whiteSugar;
    this.milk = milk;
    this.chocolate = chocolate;
    };
    // Slogan
    Items.prototype.slogan = function () {
    return `This item is made by Harshit`
    };
    Let quantity = new Items (2, "1 cup", "1cup", "1 dark chocolate");
    Console.log(quantity);
    // Cake inherit with items
    function cakeItems(eggs, whiteSugar, milk, chocolate, water, flour) {
    Items.call(this,eggs, whiteSugar, milk, chocolate);
    this.water = water;
    this.flour = flour;
    };
    //
    cakeItems.prototype = Object (Items.prototype);
    // Inherit the prototype
    cakeItems.prototype.constructor = cakeItems;
    // Manually set the constructor
    Let cakeReady = new cakeItems (2, "1 cup", "1cup", "1 dark chocolate", "2 cups", "200g");
    Console.log(cakeReady);
    Console.log(cakeReady.slogan());

  • @yatharthsingh4997
    @yatharthsingh4997 2 ปีที่แล้ว +1

    // cake quiz
    function items(flour, bakingpowder ,sugar) {
    this.flour = flour;
    this.bakingpowder = bakingpowder;
    this.sugar = sugar;
    }
    let cake = new items('200g', '2 pinch', '100g');
    console.log(cake);
    function newItems(flour, bakingpowder, sugar, flavor, toppings) {
    items.call(this, flour,bakingpowder,sugar);
    this.flavor = flavor;
    this.toppings = toppings
    }
    let newCake = new newItems('500g', '4 pinch', '400g', 'strawberry', 'chocolate');
    console.log(newCake);

  • @ArunKumar-jg8gx
    @ArunKumar-jg8gx 2 ปีที่แล้ว

    East or west Harry bhaiya best🔥🙂

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

    thank you so much harry sir, u r very humble..

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

    Best java script tutorial...bolo Tara Ra Ra.

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

    pranam guru ji

  • @MuhammadSaeed-su7tk
    @MuhammadSaeed-su7tk 3 ปีที่แล้ว +4

    harry bhai, I think __proto__ and prototype are two different things.
    eg: __proto__ is for creating inheritance between two objects and prototype is for creating setters and getters, correct me plz if I'm wrong.
    and bhai ap ki prototype inheritance wali video nay confuse krdia hai.

    • @ManishSingh-lk4qs
      @ManishSingh-lk4qs 3 ปีที่แล้ว +2

      mujhe bhi bhai, jab harry ek object define kiya hai to use Object.create me dalne ki kya jaroorat hai, wo to already object define kiya hai with the help of object literal.

    • @nishkarshjain5684
      @nishkarshjain5684 2 ปีที่แล้ว +1

      No u r right harry is wrong & stupid too 😂😂😂👍🏻

  • @04.nehalsingh12
    @04.nehalsingh12 2 ปีที่แล้ว

    awesome tutorial sir

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

    Harry bhai has a true friend Rohan Das 😂❤, thanks for the tutorial 😇

  • @FaizanAli-xp8qi
    @FaizanAli-xp8qi 4 ปีที่แล้ว +9

    var flour=function(material,water)
    {
    this.cakematerial=material;
    this.cakewater=water;
    }
    var cake=function(material,water,price,type)
    {
    flour.call(this,material,water);
    this.cakeprice=price;
    this.caketype=type;
    document.write(this.cakematerial,this.cakewater,this.cakeprice,this.caketype);
    }
    new cake("floor","plain water",220,"Chocolate");

  • @neilrehani.1409
    @neilrehani.1409 3 ปีที่แล้ว +4

    14:15: Sir, if we are inheriting already from employee class & also we are writing our own. So what is the use of inheriting?

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

      yes same this is my question

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

      we are giving values which wasn't assigned during construtor initializing

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

    Finally, prototype smjh aaya

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

    quiz solution
    function flour(egg,premix,sugar){
    this.egg = egg;
    this.premix = premix;
    this.sugar = sugar;
    }
    flour.prototype.slogan = function(){
    return `This is the best cake`
    }
    let Cake = new flour(2,'500g','200g')
    console.log(Cake);

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

    BTW who is Rohan Das?

  • @utkarshsingh2912
    @utkarshsingh2912 2 ปีที่แล้ว +1

    console.log('ProtoType Inhertence');
    function ingredients(flour, bakingPowder){
    this.flour = flour;
    this.bakingPowder = bakingPowder;
    }
    let Product = new ingredients('500g','20g');
    console.log(Product);
    function cake(flour, bakingPowder, chocolate, yeast){
    ingredients.call(this,flour,bakingPowder);
    this.chocolate = chocolate;
    this.yeast = yeast;
    }
    let blackForest = new cake('800g','50g','200g','100g')
    console.log(blackForest)

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

    function food(aata, vanilla) {
    this.wheat = aata;
    this.serum = vanilla;
    }
    let me = new food("ashirvaad", "js6");
    console.log(me);
    food.prototype.ss = function() {
    return `mrbrown`;
    }
    function cake(aata, vanilla, serup, sugar) {
    food.call(this, aata, vanilla, )
    this.serupp = serup;
    this.sug = sugar;
    }
    let bakes = new cake("ashirvaad", "js6", "thick", "jyadamithanhi");
    console.log(bakes);

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

    function Flour(type,brand,baker,egg){
    this.type = type
    this.brand = brand
    this.baker=baker
    this.egg=egg
    }
    Flour.prototype.mix = function(){
    `Mixing ${brand} Flour And ${egg}`
    }
    function Cake(flavour,toppings){
    Flour.call(type,brand,baker,egg)
    this.toppings = toppings
    this.status = function(){
    "The Cake Is readY To Eat"
    }
    }
    Cake.prototype = Object.create(Flour.prototype)
    Cake.prototype.constructor = Flour

  • @mdasif-ze7bc
    @mdasif-ze7bc ปีที่แล้ว

    function flore(ingredent){
    this.ingredent=ingredent
    }
    flore.prototype.slogan=function(){
    return "cake ready to surve"
    }
    function cake(ingredent,name, egg, milk ){
    flore.call(this,ingredent)
    this.name=name
    this.egg=egg
    this.milk=milk
    }
    cake.prototype=Object(flore.prototype)
    let cake2=new cake("wheet","chocolate", "6","3")
    console.log(cake2)
    console.log(cake2.slogan())

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

    when you called employee.call(), why u put 'this' before properties ?

  • @RahulSahu-rk5ry
    @RahulSahu-rk5ry 3 ปีที่แล้ว

    function food(flour, soda, flavour, butter) {
    this.flour = flour;
    this.soda = soda;
    this.flavour = flavour;
    this.butter = butter;
    }
    function cake(flour, soda, flavour, butter, mix, bake) {
    food.call(this, flour, soda, flavour, butter);
    this.mix = mix;
    this.bake = bake;
    }
    cake.prototype = Object.create(food.prototype);
    cake.prototype.constructor = cake;
    let chocolateCake = new cake("maida", "bakingPowder", "chocolate", "desiGhee", "bowl", "microwave")
    console.log(chocolateCake)

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

    console.log("exercise 3");
    function temp(type,water,milk,sugar,oil) {

    this.type=type;
    this.water=water;
    this.milk=milk;
    this.sugar=sugar;
    this.oil=oil;
    }
    //set prototypee
    temp.prototype.type1=function(){
    return `making ${this.type}`;
    }
    //create object
    let flour=new temp('flour',200,000,'2 ts','2 ts');
    console.log(flour);
    //inherit temp cunstructor
    function cake(type,water,milk,sugar,oil,chocolate,backingPowder){

    temp.call(this,type,water,milk,sugar,oil);
    this.chocolate=chocolate;
    this.backingPowder=backingPowder;
    }
    //inherit prototype
    cake.prototype=Object.create(temp.prototype);
    //manully set counstructor
    cake.prototype.counstructor=cake;

    let cakeMake=new cake('cake',200,200,'10 ts','10 ts',200,'1/2 ts' );
    console.log(cakeMake);

  • @ankitbanerjee9082
    @ankitbanerjee9082 5 ปีที่แล้ว +2

    Koi batyega bhai !! PyAudio ko kaisay thik krna hn 😵 help

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

    Please upload a video in python toutril , connect mysal with pycharm

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

    I will do quiz after something,
    And the challenge is accepted

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

    //Food
    function food(atta,bakingPowder,Eno)
    {
    this.atta=atta;
    this.bakingPowder=bakingPowder;
    this.Eno=Eno;
    }
    let foodItems=new food("B1","BP1","Eno1");
    console.log(foodItems);
    //Cake
    function cake(atta,bakingPowder,Eno,cream)
    {
    food.call(this,atta,bakingPowder,Eno);
    this.cream=cream;
    }
    //Inherit Prototype
    cake.prototype=Object.create(food.prototype);
    //Constructor
    cake.prototype.constructor=cake;
    let cake1=new cake('A1','BP1',"Eno1","ChoclateCream");
    console.log(cake1);

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

    bhai pehli bar kisi educational video dekh k hasi rukh ni parah hu.. Rohan das ki sal 2 rs

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

    #quiz
    function Flour(takeFlour, results){
    this.takeFlour = takeFlour;
    }
    function cake(takeFlour,addWater,addSugar,addEgg){
    Flour.call(this,takeFlour);
    this.addWater = addWater;
    this.addSugar = addSugar;
    this.addEgg = addEgg;
    }
    cake.prototype.makeCake = function(){
    return `cake is ready which is mage up of ${this.takeFlour}gm of flour, ${this.addWater}gm of water, ${this.addSugar}gm of suger and ${this.addEgg} eggs.`;
    }
    let pastry = new cake(100,30,20,2)
    console.log(pastry.makeCake());
    Output:-cake is ready which is mage up of 100gm of flour, 30gm of water, 20gm of suger and 2 eggs

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

    16:00min
    Done done
    Again

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

    sir django ko each and evry way me kaise optimise karein production level pe ispe ek series banayiye , aur html,css and javascript ko kaise minify karein

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

    //constructor
    function food(gname, gcolor, gconsistency) {
    this.name = gname;
    this.color = gcolor;
    this.consistency = gconsistency;
    }
    //flavor prototype
    food.prototype.color = function () {
    return `The color of ${this.name} is ${this.color}`;
    }
    let flour = new food('flour', 'white', 'powder');
    console.log(flour);
    //inheritance for cake
    function cake(gname, gcolor, gconsistency, gcombo) {
    food.call(this, gname, gcolor, gconsistency);
    this.combo = gcombo;
    }
    let vanillachocko = new cake("cake", "brown", "softsponge", "vanilla and chocklate");
    console.log(vanillachocko);

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

      #CodeWithHarry sir please check

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

    Thanks a lot sir ...

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

    console.log('Now you are online.');
    function Food(size='not_given',spices='not_given',taste='not_given'){
    this.flour = size;
    this.spices = spices;
    this.taste = taste;
    }
    Food.prototype.slogan = function(){return 'Food was so special.';}
    let food = new Food(undefined,'American');
    console.log(food);
    // console.log(food.slogan);
    function Cake(size,spice,taste,sweetness){
    Food.call(this,size,spice);
    this.sweetness = sweetness;
    }
    Cake.prototype = Object.create(Food.prototype);
    Cake.prototype.constructor = Cake;
    let bdaycake = new Cake('not_much_fine','no_spices','yummy','high');
    console.log(bdaycake);

  • @neilrehani.1409
    @neilrehani.1409 3 ปีที่แล้ว

    function MultiFlour(grain, corn, oats, peanuts, rice, rye)
    {
    this.grain = grain;
    this.corn = corn;
    this.oats = oats;
    this.peanuts = peanuts;
    this.rice = rice;
    this.rye = rye;
    }
    let mFlour = new MultiFlour(400, 200, 10, 100, 200, 130);
    MultiFlour.prototype.slogan = function ()
    {
    console.log("This cake is the best of the best!");
    }
    function Cake(grain, corn, oats, peanuts, rice, rye, degrees, water, egg, flavour)
    {
    MultiFlour.call(this, grain, corn, oats, peanuts, rice, rye)
    this.degrees = degrees;
    this.water = water;
    this.egg = egg;
    this.flavour = this.flavour
    }
    Cake.prototype = Object.create(MultiFlour.prototype);
    Cake.prototype.constructor = Cake;
    let chocoCake = new Cake(90, 500, "Chocolate");
    console.log(chocoCake);

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

    function Ingredients(flour,egg,bakingPowder){
    this.flour=flour;
    this.egg=egg;
    this.bakingPowder=bakingPowder;
    }
    Ingredients.prototype.slogan = function(){
    return `This is the best cake! Baked at ${this.oven} Degree Centigrade`
    }
    function cake(flour,egg,bakingPowder,oven){
    Ingredients.call(this,flour,egg,bakingPowder)
    this.oven=oven;
    }
    cake.prototype = Object.create(Ingredients.prototype);
    cake.prototype.constructor = cake;
    const a = new Ingredients("flour",3,1);
    console.log(a);
    const cake1 = new cake(1,3,1,250);
    console.log(cake1.slogan());

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

    Nice video harry sir

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

    19:05
    what happen if we don't set the constructor of programmer and why we need to set the constructor of programmer?

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

      Then, how will we know the qualities of programmer (like experience ,name etc.) and also we are inheriting some of his qualities from employee, so we have to define a constructor in order to make a proper object with it.(hope this will clear your doubt)

  • @vickysharma-dc8in
    @vickysharma-dc8in 4 ปีที่แล้ว

    console.log("Run Properly!");
    let food = function(water,atta){
    this.water = water;
    this.atta = atta;
    this.quantity = function (){
    console.log(`water = ${this.water}, atta = ${this.atta}`);
    }
    }
    let cake = function(sugar,cream,water,atta){
    food.call(water,atta);
    this.sugar = sugar;
    this.cream = cream;
    this.totalQuantity = function (){
    console.log(`water = ${water} atta = ${atta} sugar = ${this.sugar} and cream = ${this.cream}`);
    }
    }
    let obj = new cake("20ml","5kg","3kg","200gm");
    console.log(obj);

  • @rosonerri-faithful
    @rosonerri-faithful 3 ปีที่แล้ว +1

    Exercise Quiz:
    function Ingredients(maida, sugar, egg, bakingPowder,type) {
    this.maida = maida;
    this.sugar = sugar;
    this.egg = egg;
    this.bakingPowder = bakingPowder;
    this.type=type;
    }
    Ingredients.prototype.comment = function () {
    return `This ${this.type} cake is very tasty! It has used ${this.maida}kg, uses ${this.sugar}tablespoon of sugar, ${this.egg}eggs & ${this.bakingPowder} bakingPowders`
    }
    let make = new Ingredients(2, 9, 3, 3,"ChocoVanilla");
    console.log(make.comment());
    function Cake(maida, sugar, egg, bakingPowder,type,price) {
    Ingredients.call(this,maida, sugar, egg, bakingPowder,type,)
    this.price=price;
    }
    Cake.prototype=Object.create(Ingredients.prototype);
    Cake.prototype.constructor=Cake;
    let cake=new Cake(3,10,5,6,"ChocoVanilla",5000)
    console.log(cake.comment());

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

      Cake.prototype.constructor=Cake;
      agar yeh nahi kia to kya hoga??

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

    @CodewithHarry Bhai yeh RohanDas Kaun hai humesha Iska example use karta ho

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

    //create a constructor for floor
    function floor(name, color, experience){
    this.name = name,
    this.color = color,
    this. experience = experience
    }
    floor.prototype.salogun = function(){
    return `This cake for birthday ${this.name}`;
    }
    let flo = new floor('Hamza', 'White', 1);
    // console.log(flo);
    //create a constructor for cake
    function cake(name, salary, experience, birthday){
    floor.call(this, name, salary, experience);
    this.birthday = birthday
    }
    cake.prototype = Object.create(floor.prototype);
    cake.prototype.constructor = cake.prototype;
    let cak = new cake('Hamza','White', 1, 'Seven August');
    console.log(cak);

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

    If we can create custom objects using Object.create() then why do we need constructors?

  • @MahendraKumar-xe5hk
    @MahendraKumar-xe5hk 5 ปีที่แล้ว

    👌👌👌👌 harry bhai.....

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

    Biggest fan

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

    Dimaag Chakra gaya Harry Vaiiii!!!

    • @Raj-jz4fc
      @Raj-jz4fc 3 ปีที่แล้ว +1

      mera bhi bro

  • @RohitKumar-re2fz
    @RohitKumar-re2fz 2 ปีที่แล้ว

    Line no. 46 me arguments me 'this' galti se likha h ?

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

    maja agaya sir.

  • @muhammadshazil923
    @muhammadshazil923 2 ปีที่แล้ว +1

    let flour=function(ingredients)
    {
    this.ingredients =ingredients ;
    }
    flour.prototype.make=function()
    {
    console.log("cake is made ");
    }
    let me= new flour();
    console.log(me);
    // me.make();
    function cake(ingridients,sugar,spoon)
    {
    flour.call(this,ingridients);
    this.sugar=sugar;
    this.spoon=spoon;
    }
    // make_cake.make();// error de ga coz prototype isn't made yet
    cake.prototype = Object.create(flour.prototype);
    let make_cake = new cake('atta',10,1);
    make_cake.make();
    console.log(make_cake);

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

    // Excersize
    function flour(flourName , Sugar, Jam){
    this.flourName = flourName;
    this.Sugar = Sugar;
    this.Jam = Jam;
    }
    flour.prototype.titleTheme = function(){
    return `${this.flourName} flour and ${this.Sugar} sugar and ${this.Jam} are needed to make the cake`;
    }
    function cake(flourName , Sugar, Jam, CakeName){
    flour.call(this, flourName , Sugar, Jam);
    this.CakeName = CakeName;
    }
    let cake1 = new cake('Prabhat', 'Madhur', 'Ketchup', 'VanillaIceCake');
    console.log(cake1);

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

    function flour(egg,baking_soda,sugar){
    this.egg=egg,
    this.baking_soda=baking_soda,
    this.sugar=sugar
    }
    flour.prototype.slogan= function(){
    return `this is best cake`;
    }
    let make = new flour(2,"60gm", "500gm");
    console.log(make);
    function cake(egg,baking_soda,sugar,water,oven){
    flour.call(this,egg,baking_soda,sugar)
    this.water=water,
    this.oven=oven
    }
    cake.prototype=Object.create(flour.prototype);
    cake.prototype.constructor=cake;
    let cook=new cake(4,'60mg','600gm','1L','one oven for cock');
    console.log(cook)

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

    function food(dishName,category,taste) {
    this.dishName= dishName,
    this.category= category,
    this.taste= taste;
    }
    food.prototype.slogan = function(){
    return (`This ${this.dishName} is delicious`);
    }
    function cake(dishName,category,taste,type){
    food.call(this,dishName,category,taste);
    this.type= type;
    }
    cake.prototype = Object.create(food.prototype);
    cake.prototype.constructor= cake;

    let curr= new cake('Cake','Beverage','Sweet','Black Forrest');
    console.log(curr);

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

    function flour(name,quantity){
    this.name=name;
    this.quantity=quantity;
    }
    flour.prototype.calories=function(){
    return (this.quantity*1000/100)*200;
    }
    flour.prototype.price=function(){
    return this.quantity*100;
    }
    aata=new flour("aashirwaad",5);
    function cake(name,quantity,design){
    flour.call(this,name,quantity);
    this.design=design;
    }
    cake.prototype=Object.create(flour.prototype);
    cake.prototype.constructor=cake;
    mickey=new cake("patanjali",1,"mickey");

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

    function cake(flavour, isVeg, topping){
    this.flavour = flavour;
    this.isVeg = isVeg;
    this.topping = topping;
    }
    cake.prototype.likeIt = function(likeit){
    return `I love the ${this.flavour} its ${this.isVeg} but i like it ....${likeit}`
    }
    let doubleChocoCake = new cake('chocolate cake', 'non-veg ', 'chocochiips');
    function vanilla(flavour, isVeg, topping, cream){
    cake.call(this, flavour, isVeg, topping);
    this.cream = cream;
    }
    vanilla.prototype = Object.create(cake.prototype);
    vanilla.prototype.constructor = vanilla;
    let vanillaCake = new vanilla('vanilla', 'vegetarian', 'butter chips', 'white-cream');
    console.log(vanillaCake);

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

    REACT Js par bhi bna dena tutorial plzzz

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

    Please teach assembly language programming pleaseeee

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

    const proto = {
    changeName:function(newName){
    this.name=newName;
    }
    }
    let eating = Object.create(proto);
    eating.name1= "fruit";
    eating.name2= "sweets";
    function fruit(name){
    this.name= name;
    }
    let obj = new fruit("Apple");
    function sweets(name,flavor){
    fruit.call(this,name);
    this.flavor=flavor;
    }
    sweets.prototype=Object.create(fruit.prototype);
    sweets.prototype.construtor=sweets;
    let obj2 = new sweets("cake","vanilla");
    console.log(obj2);

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

    Everyone is Rohan Das !!

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

    Revision of the code at 17:11.

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

    //Ingredient Constructor
    function ingredient(sugar, egg, chocolate, flour) {
    this.sugar = sugar,
    this.egg = egg,
    this.chocolate = chocolate,
    this.flour = flour
    };
    ingredient.prototype.slogan = function () {
    return `This taste good`;
    }
    //Cake
    function Cake(sugar, egg, chocolate, flour, flavour) {
    ingredient.call(sugar, egg, chocolate, flour);
    this.flavour = flavour;
    }
    //Inherit the prototype
    Cake.prototype = Object.create(ingredient.prototype);
    //Manually set the constructor
    Cake.prototype.constructor = Cake;
    let blackForest = new Cake(10, 3, 33, 23, 'BlackForest');
    console.log(blackForest);

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

    function Materials(material, water) {
    this.material = material;
    this.water = water;
    }
    function Cake(material, water, type, price) {
    Materials.call(this, material, water);
    this.type = type;
    this.price = price;
    }
    let cake1 = new Cake("floor", "plain water", "chocolate", 200);
    console.log(cake1);

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

    function Fruits(name,colour,taste){
    this.name=name;
    this.colour=colour;
    this.taste=taste;
    }
    Fruits.prototype.slogan=function(){
    return ` The ${this.name} have ${this.colour} colour and have ${this.taste} taste.` ;
    }
    let apple = new Fruits("Apple","Red","Sweet");
    console.log(apple);
    console.log(apple.slogan());
    function Cake(name,colour,taste,cakeColour,cakeWeight){
    Fruits.call(this,name,colour,taste);
    this.cakeColour=cakeColour;
    this.cakeWeight=cakeWeight;
    }
    Cake.prototype=Object.create(Fruits.prototype)
    Cake.prototype.slogan=Caske;
    let cake=new Cake("Mango","Yellow","Sweet","Yellow",5);
    console.log(cake);

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

    Sir rust ka bara m b kindly shro kara thanks

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

    function food(food1, food2, food3) {
    this.food1 = food1;
    this.food2 = food2;
    this.food3 = food3;
    }
    let ans = new food('flour', 'sugar', 'eggs');
    console.log(ans);
    function cake(food1, food2, food3, food4) {
    food.call(this, food1, food2, food3);
    this.food4 = food4;
    }
    let ans2 = new cake('flour', 'sugar', 'eggs', 'butter');
    console.log(ans2);

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

    function flour(quantity, quality) {
    this.quantity = quantity;
    this.quality = quality;
    };
    flour.prototype.slogan = function(name) {
    return `This is a ${this.quality} quality ${name}`;
    };
    let flour1 = new flour(100, 'Great');
    console.log(flour1);
    console.log(flour1.slogan('bread'));
    function cake(quality, quantity, type, price) {
    flour.call(this, quality, quantity);
    this.type = type;
    this.price = price;
    };
    cake.prototype = Object.create(flour.prototype);
    cake.prototype.constructor = flour;
    let cake1 = new cake('Amazing', '500g', 'Red Velvet', 'Rs 1000');
    console.log(cake1);

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

    // Quiz
    function flour(material, water, choclate) {
    this.cake_material = material;
    this.water = water;
    this.choclate = choclate;
    }
    flour.prototype.recipe = function() {
    document.write(`First boil ${this.water} then put some ${this.material} and in the end add some ${this.choclate}`);
    }
    function cake_making(material, water, choclate, freeze) {
    flour.call(this, material, water, choclate);
    this.choclate = choclate;
    }
    cake_making.prototype = Object.create(flour.prototype);
    cake_making.prototype.remaining_recipe = function () {
    document.write(`After 30 minutes put that material in a baker and then freeze it in cool air then put it into ${this.freeze}`);
    }
    let obj = new cake_making("Maida", "water", "Choclate powder", "Regrigrator");
    console.log(obj);

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

    Harry bhai html mai navigation bar banana shikayaina

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

    Sir Please uploads Java and Android tutorials videos

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

    Hi Haris Khan

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

    why should javasceipt need prototype

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

    So here is the ans -
    function food(milk, sugar, bread){
    this.milk = milk;
    this.sugar = sugar;
    this.bread = bread;
    }
    food.prototype.slogan = function(){
    return `I gonna to make a cake with these.`;
    }
    let obj = new food('milk', 'sugar', 'bread');
    console.log(obj);
    function cake(milk, sugar, bread, floor){
    food.call(this, milk, sugar, bread);
    this.floor = floor;
    }
    // Inherit the prototype
    cake.prototype = Object.create(food.prototype);
    // Manually set the constructor
    cake.prototype.constructor = cake;
    let obj2 = new cake('milk', 'sugar', 'bread', 'floor')
    ;
    console.log(obj2);

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

    16:11 nai samjha manually set the constructors

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

    bhai aj to bata hi do ye "Rohan das" and "Shubham" apke best friend ka hi name he na.

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

    itna acha commet kaisa jab ki bahut si chij jo is video ma use ki ha plsylist ma nahi batai ha

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

    YE BHAI CODE THK SE RUN NAHIN HO RAHA HAI

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

    function flour(item1){
    this.Item1=item1;
    }
    flour.prototype.makeFlourForCake=function(){
    console.log("flour is ready");
    }
    cake.prototype=Object.create(flour.prototype);
    //cake.prototype.constructor=cake;
    function cake(item1,item2,item3){
    flour.call(this,item1);
    this.Item2=item2;
    this.Item3=item3;
    }
    cake.prototype.isCakeReady=function()
    {
    return "cake is ready";
    }
    let c=new cake("flour","butter","Egg");
    c.makeFlourForCake();
    console.log(c.Item1,c.Item2,c.Item3)
    console.log(c.isCakeReady());

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

    Bro Who is Rohan Das??...and uski salary apne Rs.2 kyu rakhi

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

    Sir please uploads JAVA and Android tutorial Videos

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

    Header and footer banana na shikhayaij

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

    RIP Rohan

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

    // cake recipe
    function Flour(water, egg, oil){
    this.water = water;
    this.oil = oil;
    this.egg = egg;
    }
    Flour.prototype.slogan = function(){
    console.log(`This is my fav cake recipe !!`);
    }
    let recipe = new Flour("1 liter", 5, "2 litres");
    console.log(recipe);
    function Cake(water, egg, oil, berries){
    Flour.call(this, water, egg, oil);
    this.berries = berries;
    }
    Cake.prototype = Object.create(Flour.prototype);
    Cake.prototype.constructor = Cake;
    let blackforest = new Cake("1 liter", 5, "2 litres", "blue");
    console.log(blackforest);
    //Thank you;

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

    Didn't understand anything