Hey ninjas, in this JavaScript tutorial for beginners, we’ll make our very own object using the car analogy from the last lesson. I’ll show you how to create the object, add properties and methods, and finally how to use the shorthand notation to do this.
As always, if you have any questions, fire away :).
SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1
========== JavaScript for Beginners Playlist ==========
========== CSS for Beginners Playlist ==========
========== HTML for Beginners Playlist ==========
========== The Net Ninja ============
For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk
========== Social Links ==========
Twitter – @TheNetNinja – https://twitter.com/thenetninjauk
Original source
29 responses to “JavaScript Tutorial For Beginners #28 – Creating a new JavaScript Object”
ok, dude, love the vids, but i keep getting this error after following your code to the letter… Uncaught TypeError: myCar is not a constructor.. please help
one of the best js object explanation I have seen. Greatly appreciated sir.
I'm loving these video tutorials. Just bought a hoodie to show the love. Thank you!
Hi! I'm just wondering how come you can just put in myCar.maxSpeed myCar.driver but you have to put a function in myCar.drive. And what is the function doing? please help!
Thx! 🙂
I have tried removing the semi colon and ran it on the browser …to my surprise it works even then! What is the use of the semi-colon?
great lesson thanks a lot
Every thing is okay, But what is the use of "New" key word
Brilliant!
Shouldn't "speed" and "time" variables used in the function be defined before using them??
your every tutorial video is short…………….
seriously you are the one ring to rule web development courses. Your tuts are great ah.
hi ninja just to clarify, about that
var mycar 2 = {
driver: function() {}
}
so basically it says that, whatever result in the function () will be assign to property name driver right? and the driver will be the property of mycar 2
This is really excellent. Explained in much details; I think whoever thought javascript was too hard to learn before will change his/her mind after watching your videos. Brilliant teacher, Well done!
Easy to learn, easy to understand thanks for the lectures. Hope to learn more from you!.
18 Videos to go!! (Road to Front End Web DEsigning)
Great video!!! 🙂
This was amazing. I've never seen objects so easy to understand.
awesome
does the shorthand automatically create a new object?
was a lot to take in this episode, but ithink i got the hang of it very soon!
He is typing WAY too fast!
Hi, I would like to ask is it a must to print something out from the function /methods as i had noticed that you would include console.log in the function or setting a value for the function. Is there a way of not printing anything using the method of:
var myCar ={
properties
method
};
Hi great videos!!
I have a question. maybe I'm stupid and did something wrong here.
i got the result "undefined" when i make my code like this.
var name = new Object();
name.age = 50;
name.lastName = "Jenny";
name.age = "Johan";
name.eyeColor = "blue";
console.log(name.age);
cant i use name as an variable to be an object or what did i do wrong here?
var a= new Object();
a.speed = 100;
a.driver = 'dell';
console.log(a.driver);
(or)
var a =
{
speed = 100;
driver = 'dell';
console.log(a.speed);
}
what's the difference?which one can i use?
Gahhh that slicing sound in the beginning when you have your headphones on to the max HURTS! 🙁
it's a very good tutorial i like it but i need a good reference or a book could you recommend one for me ?
It's getting little bit complicated! :-/
You're a great teacher. Everything is clear and easy to understand. Thank you for uploading all these tutorial videos.
Great tutorial man, quick simple and gets right to the point.