13: What are JavaScript Properties and Methods | Properties and Methods | JavaScript Tutorial
HTML-код
- Опубликовано: 1 окт 2024
- What are JavaScript Properties and Methods | Properties and Methods | JavaScript Tutorial. In this JavaScript tutorial you will learn about properties and methods used on JavaScript objects. Examples of objects include variables and arrays, which are used often in JavaScript scripts.
List of all properties: developer.mozi...
List of all methods: developer.mozi...
➤ GET ACCESS TO MY LESSON MATERIAL HERE!
First of all, thank you for all the support you have given me!
I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!
I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.
I hope you will find it helpful :)
Material for this lesson: / lesson-material-42361704
As soon as i saw the thumbnail i though "Elon Musk is going to teach me Properties and Methods"
Never thought about methods being built-in functions! Interesting perspective.
I really like this take on it as well. Helps me understand methods more and how they’re different from functions.
Fun fact: the spacing or capitalization of the second word, like the ones used in methods, is called "Camel Casing" since the camel's hump is taller than its head.
thx for information
var item = ["Bottle", 4, true];
items.push("Juice");
console.log(item.push("Juice"));
could someone please let me know why will this result in 5? How is that counted?
by adding juice inside console log he actually added another "juice" so total amount to 5 indexes , if you were to delete 2nd one then it will count as 4; hope u understand.
@@meliodass6951 Thank you, I also didn't understand the '5'.
5 is length of the list
While indexing it count form 0
I was learning JS using some bootcamp tutorial videos and had to finish assingments. Unfortunately those videos provided much less info than you need to know for completing their assignments and it was a real struggle to complete them with lack of information. Your way of explaining stuff is truly awesome. I understand these concepts much better now thanks to your tutorial. You explain everything really detailed. You have a talent for teaching.
Thanks for these tutorial videos. Cheers!
i agree totally.
was it colt's complete udemy bootcamp?
You are really great! I love the way you teach!
Love your videos.. These videos helps me alot.. Thank you
But Daniel, i don't understand i've thought a lot about it and i just can't figured out. How is "juice" in the 5th position if there was 4 item inserted. i've try it my self and i've got same result (5). but the length property still says 4. why is that?
thank you for the course it is very good
It is because we always start counting at 0 in programming. 🙂 So instead of 1, 2, 3, 4.... It's 0, 1, 2, 3. We call these numbers the "index", which is kinda like the "position".
The reason we get "4" as the result when we use .length, is because it is counting the number of entries, and not the index.
Hope this helped. 🙂
@@Dani_Krossing thanks Dani but i'm afraid i still don't quite understand why isn't "juice" at the 4th position instead of 5th. you pushed in an item, this item is meant to be st third podition regarding index but the length shoun't be 4?.
i'm quite aware that i'm the problem here. omg i just can't figure out what is that i'm missing. 🤔
I appreciate your response Daniel, i'll study harder
u deserve more viewers and subscscscribersoto THANks for epicccccccccccccc Teaching ;)
Thank you my friend, it's very helpful.
How come the precision index of juice showed 5 ? Should have been 3 isn’t it ? Please can you explain me the last part
I thought the same thing. If you just do items.push("Juice") followed by console.log(items.push()); it will give you 4 indices ["Bottle, 4, true, "Juice"]. If you include ("Juice") within the console to push that item, it seems like it pushes it twice, giving you 5 indices instead of 4. I'm new to this, so that's what it seems like to me....
I also thought the same, gave the same explanation to myself and continued with the course.
"The push() method adds new items to the end of an array, and returns the new length." so when he wrote items.push("Juice") it added "Juice" and returned the new length which is 4, same would have happened if he wrote instead console.log(items.push("Juice")), would have returned 4, however, he wrote console.log(items.push("Juice")) after items.push("Juice")which means juice was added once and returned array length 4 and then again and returned length 5.
How can indexOf not also be defined as a property if its "job" is to tell you the position of where certain characters are just how .length also just tells you the length of the variable.
Are they not just, both essentially, telling you something about our variable? Thank you!
I’ll do my best to explain.
The difference between methods and properties in JavaScript boil down to two simple ideas: methods are dynamic, properties are static.
I’ll expand. Methods perform operations / actions on values, hence the term ‘dynamic’. In the case of indexOf() - it is not merely telling you the position of a character, it actively scans and searches the string of characters given the arguments its fed: indexOf(‘of’), with ‘of’ being the argument given, and returns the position of the string. This argument (‘of’) can be changed to a different word to find a different position in the string. It’s interactive and changing, accepting different inputs and performing unique scans / searches each time the argument is changed.
On the other hand, properties are static - meaning they do not perform actions or operations. Properties, as its name suggests, can be viewed as the inherent characteristics, features, or attributes of an object. Properties store or represent information of an object. Properties give us access to information, rather than perform computational actions that return a result. In the case of .length, the information it represents (provides access to) is the length of characters: a characteristic of the string.
Hope this helps.
@@aishahcarana-masiroh6691
Thank you for the explanation but length is still performing the action of counting how many characters it has in one way or another, no?
I was thinking the same analogy but thinking about finding the length of something is also an "action" broke it.
How I ended up viewing it, which has not broken yet, is that
Properties : Look at the element as a whole, while
Methods : Can look at the individual elements of that element
Hopefully I make sense too lol
Excellent. All of your lessons. That dog's breathing though. LoL
Great explanation!! thank you!:-) now I catch the differences
Yes he's back! :D
Back again
When i entered item.length
["Botle of water"]
👆
For this instead of blah blah i got 1
Then i entered
console.log(item.indexOf("of"));
Instead of 7 i got -1
And when is did
console.log(item.replace("water", "juice"));
🤥its telling item.replace is not a function
I thumbs up every vid and will suggest you to other coders I come across. Great stuff!
We need the complete Javascript and Jquery tutorials
Loved it, I was stuck in this subject since yesterday and your video made it super easy, FYI your links on the video are expired
Thanks a lot! That was helpful spotting the difference!
how come this channel has only 155k subscribers. Should have more. In fact it will have 3M by the end of the year in Jesus' name Amen.
Lumen Nganje you honestly think that works? 🙄
deserves KUDOS someone finally explaining methods and objects using code, without cats or dogs
*Dani Krossing* where can I finde your RUclips videos about methods and more in JavaScript ? some one send me the link please
hope you have a Vue series soon if u use that framework. love all your vids
Very helpful video. Thank you so much :)
sir how to make full website in html and css please post one video of full website making
this lesson is just perfect
No, no. It's you that are perfect
We have one teacher that teach us java and he is idiot.. from then i dont want to do it but from when i discovered you i want to make everything
i love u!! thanks for explaining properly what a method is
Just wanted to thank you for explaining it for a newbie
Niiice Thank U
Thank you so much
Thanks a million
good tutorial!, i realise the programming languages use similar methods, just in different syntax, easy to understand after learning python
Thank u so much for this great videos ❤️
Huge props from Israel, great great channel !!
Excellent
Great. Thanks for the lists, too!
THANKS
Very helpful! Just wondering why the Push one at end showed up as 5 for length, I thought it’d be 3?
Me too
really helpful, thanks!
Thanks for the tutorial! Around 1:45 in this video you are defining item.length and I see that in addition to predictive text, a summary of the legend property displays in your editor. Is this a built in function of Atom or some extension to display these summary/description of the property? This would be very helpful for learning the purpose of each property, etc. Any advice on how to enable/where to find this? Thanks!
It is just Atom's property. Not an extension.
Pop and push were stack operations in Assembler :)
thanks a lot, it is for kettles like me
Again.. Thanks a lot brother!
Hey Daniel! Tks for the new video :) Can u share the link for all the properties and methods?
Sorry forgot about that :) will add it now
great explanation. thanks!
hyped for the next episodes ! great work, it helped me a lot! :)
this is just like c#
your videos are perfect for recaps
Thanks
Great stuff man!
Good Job
1 like for the list
is let and var is just the same?
I have an episode earlier in this course where I cover let and var :)
mmtuts thank you I will watch later. ❤️
@@raiserjs I think he meant this one (not in this playlist) ruclips.net/video/siqBNpvEbEQ/видео.html
Great video! Thank you
Please slow your English when you speaking sir. Very difficult to understand. Very first you speaking. I am a beginner and love to watch yr each video but yr English is very much first. Hope you understand my request.
Just in case you didn't know, you can slow down a youtube video in the youtube settings. works pretty well.