// 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);
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.
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.
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);
#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
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
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);
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());
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)
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);
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)
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);
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);
// 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);
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);
// 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);
👍👍
Cake.prototype.constructor = flour;
@@lonewolfmohit it will be cake only child constructor bro
🔥🔥🔥
Combining video lectures, source code & explanation can easily beat any paid courses.
Thank you harry Bhai.
can you please provide me the source code
Best JavaScript Tutorial With Easy Explanation !
Thankyou So Much Harry, For This Superb Content ♥️
pls harry bhai REACT Pe ek series launch kro
Harry bhai REACT JS par bhi Playlist create karena
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');
14:06 Harry bro roasted Rohan 😂😂
Bhaii yrr tu to great hai, dil se❤
I will support u if you start even paid content too
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);
// 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);
Rohan das ko 2rs aur 0 years ka experience, Kya baat hai 🤣🤣🤣
Personal rivalry hai bro😂
please increase font size so it can visible
Harry bhai top notch content👏🙏
Amazing JavaScript Course on TH-cam 🥳🥳🥳🥳
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);
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);
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'));
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);
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);
@puneet kumar awasthi yeah correct thanks
Bhai prototype bilkul bhi smjh nhi aaya
// 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());
// 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);
East or west Harry bhaiya best🔥🙂
thank you so much harry sir, u r very humble..
Best java script tutorial...bolo Tara Ra Ra.
pranam guru ji
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.
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.
No u r right harry is wrong & stupid too 😂😂😂👍🏻
awesome tutorial sir
Harry bhai has a true friend Rohan Das 😂❤, thanks for the tutorial 😇
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");
14:15: Sir, if we are inheriting already from employee class & also we are writing our own. So what is the use of inheriting?
yes same this is my question
we are giving values which wasn't assigned during construtor initializing
Finally, prototype smjh aaya
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);
BTW who is Rohan Das?
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)
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);
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
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())
when you called employee.call(), why u put 'this' before properties ?
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)
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);
Koi batyega bhai !! PyAudio ko kaisay thik krna hn 😵 help
Please upload a video in python toutril , connect mysal with pycharm
I will do quiz after something,
And the challenge is accepted
//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);
bhai pehli bar kisi educational video dekh k hasi rukh ni parah hu.. Rohan das ki sal 2 rs
#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
16:00min
Done done
Again
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
//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);
#CodeWithHarry sir please check
Thanks a lot sir ...
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);
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);
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());
Nice video harry sir
19:05
what happen if we don't set the constructor of programmer and why we need to set the constructor of programmer?
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)
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);
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());
Cake.prototype.constructor=Cake;
agar yeh nahi kia to kya hoga??
@CodewithHarry Bhai yeh RohanDas Kaun hai humesha Iska example use karta ho
//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);
If we can create custom objects using Object.create() then why do we need constructors?
👌👌👌👌 harry bhai.....
Biggest fan
Dimaag Chakra gaya Harry Vaiiii!!!
mera bhi bro
Line no. 46 me arguments me 'this' galti se likha h ?
maja agaya sir.
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);
// 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);
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)
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);
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");
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);
REACT Js par bhi bna dena tutorial plzzz
Please teach assembly language programming pleaseeee
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);
Everyone is Rohan Das !!
Revision of the code at 17:11.
//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);
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);
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);
Sir rust ka bara m b kindly shro kara thanks
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);
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);
// 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);
Harry bhai html mai navigation bar banana shikayaina
Sir Please uploads Java and Android tutorials videos
Hi Haris Khan
why should javasceipt need prototype
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);
16:11 nai samjha manually set the constructors
bhai aj to bata hi do ye "Rohan das" and "Shubham" apke best friend ka hi name he na.
itna acha commet kaisa jab ki bahut si chij jo is video ma use ki ha plsylist ma nahi batai ha
YE BHAI CODE THK SE RUN NAHIN HO RAHA HAI
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());
Bro Who is Rohan Das??...and uski salary apne Rs.2 kyu rakhi
Sir please uploads JAVA and Android tutorial Videos
Header and footer banana na shikhayaij
RIP Rohan
// 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;
Didn't understand anything