javaScript object oriented programming tutorial – Understanding Objects Part 1



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 thoughts on “javaScript object oriented programming tutorial – Understanding Objects Part 1

  • February 24, 2020 at 18:03
    Permalink

    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 ?

  • February 24, 2020 at 18:03
    Permalink

    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

  • February 24, 2020 at 18:03
    Permalink

    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());

  • February 24, 2020 at 18:03
    Permalink

    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

  • February 24, 2020 at 18:03
    Permalink

    Thank you for great explanation. Watching this in 2019. when we have classes but i was not able understand this object concept. πŸ™‚

  • February 24, 2020 at 18:03
    Permalink

    Yours clear and precise explanation with sample codes is the best i have come across till now. Thank you !!!!

  • February 24, 2020 at 18:03
    Permalink

    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?

  • February 24, 2020 at 18:03
    Permalink

    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) ?

  • February 24, 2020 at 18:03
    Permalink

    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?

  • February 24, 2020 at 18:03
    Permalink

    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! =(

  • February 24, 2020 at 18:03
    Permalink

    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???

  • February 24, 2020 at 18:03
    Permalink

    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.

  • February 24, 2020 at 18:03
    Permalink

    Hi,
    The videos are nice and easy to understand. Can you provide angular 2 videos as well in such a practical approach.

  • February 24, 2020 at 18:03
    Permalink

    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.

  • February 24, 2020 at 18:03
    Permalink

    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.

  • February 24, 2020 at 18:03
    Permalink

    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?

Leave a Reply