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 responses to “javaScript object oriented programming tutorial – Understanding Objects Part 1”

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

  2. 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

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

  4. 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

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

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

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

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

  9. 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.

  10. 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.

  11. 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