JavaScript OOP Fundamentals : Part 1 ( Object Explained )
– Creating Objects
– Adding Properties to Object
– Removing Properties to Object
– Adding Methods to Objects
– Public Methods
– Private Methods
– Closures
– Inner Functions
Javascript functions are first class objects in javascript. IN this training we will understand how to write objects properly. We will use Jsfiddle to practice.
Understanding objects in Js, OOJ, Object oriented javascript , object oriented programming in javascript,
object oriented programming concepts in javascript
javascript object oriented programming
OOP JavaScript
javascript objects
javascript objects explained
javascript objects and methods
javascript object notation
javascript object literal
javascript object Properties methods
javascript function object
javascipt
#JavaScript #JavaScriptObjects #OOP
*My Udemy Courses
https://www.udemy.com/js-masterclass/
*couponCode*=TECHSITH-9.99
https://www.udemy.com/course/react-hooks-course/?couponCode=TECHSITH-9.99
Follow me for technology updates
* https://facebook.com/techsith
* https://www.facebook.com/groups/techsith
* https://twitter.com/techsith1
* https://www.linkedin.com/groups/13677140/
* https://medium.com/@patelhemil
Help me translate this video.
* https://www.youtube.com/timedtext_cs_panel?c=UCbGZKLIHpox2l0whz6_RYyg&tab=2
Note: use https://translate.google.com/ to translate this video to your language. Let me know once you do that so i can give you credit. Thank you in advance.
Original source
42 responses to “javaScript object oriented programming tutorial – Understanding Objects Part 1”
Thank you for sharing knowledge we are every hungry to learn from you thank you very much
When u created var tmp = {};
Then its again private object like anything either function or object created with var keyword inside pizza functional object are private members. Then if being crust, toppings being private members can't be accessed directly from outside, how come tmp is accessible ?
forgive me if i am wrong.
is it necessary to capture the variable in a function ????
because this is also working
var pizza= function (){
var toppings=3;
var tmp ={};
tmp.top=toppings;
return tmp;
}
var pizzaA =new pizza();
console.log(pizzaA.top);
p.s i am a novice
this.veryGood. Nice explanation of OOP. This helped me a lot. Thank you for that.
Am I doing anything wrong here Sir?
Why is my code throwing error?
var pizza = function() {
var toppings = 3;
var getToppings = function() {
return toppings;
};
var tmp = {};
tmp.getToppings = getToppings();
return tmp;
};
var obj = new pizza();
console.log(obj.getToppings());
Hello Sir…thanks for the video…got 1 quick question..
var pizza = function() {
var crust="thin";
this.toppings=3;
var tmp={};
this.getToppings=function(){
return this.toppings;
}
var getcrust=function()
{
return crust;
}
tmp.getCrust=getcrust();
return tmp;
};
var obj=new pizza();
console.log(obj.constructor);
I dont get constructor details in ouput…Instead, I get, Ζ Object() { [native code] }…can you please explain
Thank you for great explanation. Watching this in 2019. when we have classes but i was not able understand this object concept. π
Very handy
Video is very annoying for its zooming in and zooming out frequently…eyes started to strain
Yours clear and precise explanation with sample codes is the best i have come across till now. Thank you !!!!
Such pure explanation! Quite clear and not rushed in your approach. A job well done!!
var privateuserdetails=function(){
this.lastname='Name2';
this.age=2;
var firstname='Name1';
var self=this;//To access public method or variable inside private
this.getuserdetails=function(){
return this.age+ firstname;
}
var getfullname=function(){
return self.lastname+' '+ firstname;
}
var tmp={};
tmp.getfullname=getfullname;
return tmp;
}
var pud=new privateuserdetails();
console.log(pud);
console.log(pud.firstname);
console.log(pud.getuserdetails());
console.log(pud.getfullname());
While running the above piece of code i am geting error as (Uncaught TypeError: pud.getuserdetails is not a function ) .But if i run without creating tmp variable its showing the result.
Could anyone please help me out on this how to execute without error ? or where exactly i am doing wrong?
Hi @techsith , i have a doubt , why we cant access the properties using dot , is it because the object is a function object , or because the properties are defined using this (ex. 17th min in video) ?
No words to thank you for the Superb video. Feel sorry for those who disliked
At the Console.log(Pizza); step the console reads {crust:βthinβ, toppings: 3, hasBacon: true, howmanyToppings: f, price: β12$β}
I triple checked and I have it all the exact same setup, but I do not know how to keep the howmanyToppings: f, from showing. It works when I type in console.log(Pizza.howmanyToppings()); it will show three. Any ideas to fix this? Or can explain what is going on?
I don't see the closure part in my console?
1:07 category of Javascript object
5:57 create an object with property and methods
10:58 remove a property
11:47 the pizza object is a singleton
12:36 create a function object
i feel like codecademy has prepped me for nothing. finished codecademy pro, and i don't even know what "var" is or "instanceof" or "constructur"…. i am panicking like no tomorrow right now! =(
Great tutorial. Just one thing. You have not defined tmp.getToppings as public. Previously 'this' keyword is used for defining variables and methods as public in this case 'this' is not used still tmp.getToppings is public. How???
Thanks for clearly explanation about object concept..
thank YOU. I really like the way you explain in details.
Couldn't understand shit
Very well explained !
Amazing explanation of function objects with a private and public scope. Thanks for making these videos
What i have Learned (correct me if i am am wrong)
1) Can not use public method or property if using private method.
2) Semicolon after each sentence if using function object, using Singleton use comma.
3) if Assigning property outside of object, use " = " instead of " : "
Thanks tecsith for this tutorial.
Thanks, explanation skill is realy fruitfull and encouraging to learn. Ant it's easy to easier grab your lesson.
Very impresive
Great Video ..salute to you….for making closure and object creation crystal clear…..Hats off once again..
Hi,
The videos are nice and easy to understand. Can you provide angular 2 videos as well in such a practical approach.
Very helpful tutorial. Thank you.
IT really good tutorial.nice explanation about object.
Create (y) thanks very much
First of all Thank you very much for the nice video. It was really nice explanation but can you explain that how does work with core JavaScript or prototype methods to create and works with class and also want to ask understanding about some rare used methods and functions like new set() in JavaScript.
You did a great job on this. I learned a lot.
It was great, a little hard but great and clear.
Thank you very much π
In the last example (at 32:20+) when you return tmp, is there any way to access the crust variable from pizzaA?
I appreciate how you use easy to understand examples of objects, etc. in your code. While I understand the historical dependency of foo/bar, the over use makes it unintelligible to the learner.
Awesome, awesome tutorial…thank you soo much…but a curiosity…where did u find the initial background type for the presentation where you outline the topics?? This dotted purple kind dark…where did u find it?
Hey man your explanation is awesome
Wow, Superb explanation with great clarity. Thanks a lot its a brilliant video
Nice video
Is there any complete course regarding front end which covers HTML 5 , CSS3 , JavaScript , jquery , bootstrap & angular js