HomeОбразованиеRelated VideosMore From: LearnWebCode

The 10 Days of JavaScript: Day 8 (Variable Scope & Context / this keyword)

465 ratings | 11367 views
My full premium JavaScript course will be available soon, subscribe to be notified as soon as it launches. Day 0: Intro https://www.youtube.com/watch?v=dc-2t26Vuhs Day 1: Getting Started https://www.youtube.com/watch?v=K4b7LdWAVyw Day 2: Functions https://www.youtube.com/watch?v=bYshPb-wEWs Day 3: Objects https://www.youtube.com/watch?v=CXnnw9rQH5I Day 4: Arrays https://www.youtube.com/watch?v=rTK0Gmf57jE Day 5: Making Decisions https://www.youtube.com/watch?v=ZWxWx-vmubI Day 6: Higher-Order Functions https://www.youtube.com/watch?v=25VUf6pUwEU Day 7: Returning vs Mutating https://www.youtube.com/watch?v=eJ7hvnS0Bfk Day 8: Scope & Context https://www.youtube.com/watch?v=WPcW83BMT3Y Day 9: Misc. Must Know Info https://www.youtube.com/watch?v=AzxiDWeFeps Day 10: Web Browser Practice https://www.youtube.com/watch?v=HQuJzGU7TWg I'm using document.write() as a quick and dirty way to see/test values instead of always using console.log(). Please do as I say and not as I do :) Do not use document.write() for anything beyond this simple testing case and outside of CodePen I'd say never use it. In future lessons we will learn far superior ways of adding HTML content to the page from JavaScript. Also, in the real world we would never want to repeatedly update the page for each item like this, it's much better to use JavaScript to create one big string of HTML content (could concatenate to a string variable from within a while loop or forEach or even use array.reduce()) in memory first and then only add it to the page all at once. However, that's getting into efficiency and web browser performance which are not topics I wanted to address this early in the course :) Follow me for cat pics: Instagram: https://www.instagram.com/learnwebcode/ Twitter: https://twitter.com/learnwebcode Facebook: https://www.facebook.com/Brad-Schiff-1542576316048470/
Html code for embedding videos on your blog
Text Comments (56)
Raahul Daahal (8 days ago)
Mr. Brad, you are born to teach !
Cat Sweet (1 month ago)
detailed explained, learned a lot, very helpful ! thank you sir.
Sunrise Developers (2 months ago)
Rk wProgrammer (2 months ago)
Awesome lesson
Emil Andreasyan (2 months ago)
I finally understood the this keyword, thanks!!!
Andrea (2 months ago)
I hope he's not dead. He's a great teacher, makes programming interesting and clear.
Robin Tom (2 months ago)
Great Teacher! Hats OFF Sir ! Your videos, especially the teaching method are boosting my confidence level as a very beginner.
Sara Vanan (4 months ago)
you are awesome am really surprised the way you teach the most complicated concepts in a very simple and easy way ......great work buddy
Web app vista (5 months ago)
Awesome series, can't wait, get ready Udemy, Brad is coming :)
Captain Tv (5 months ago)
i am still lost for the this keyboard if it is not pointing to JOHN why do you have this.firstName in the console, really dump i can get this sorry.
U and I Dezign (6 months ago)
Awesome man! You're truly gifted when it comes to demystifying difficult to understand concepts. Many thanks and eagerly a waiting for the course to drop on Udemy. On updates on when? Thanks.
Jan Żak (6 months ago)
Your diction and the unusual, understandable way of explaining things easily makes you one of top 5 programming teachers on YT. Keep up the good work. Waiting for more.
James Kenninger (6 months ago)
0 Thumbs Down. 300 Thumbs Up. Bravo Sir. *tips hat*
Thanadilok Panyafuang (6 months ago)
it's crystal clear 🧠
Kevin Bridges (7 months ago)
i love your teaching brad, ilove how you made everything simple
Sajid Latif (7 months ago)
I'm speechless
Esdras Teixeira Costa (7 months ago)
Fantastic, just take my money lol
Learning Simplified (7 months ago)
How do you manage to stay that cool while coding live?? Each time I see your video and the first thing I say, Amazing!!
Jesse McElroy (7 months ago)
I just re watched this video and it made my 51 year old brain do 20 more push ups but I finally understand the "this" keyword 100 percent , it was a big hurdle for me , thanks a lot.
kevin zhang (7 months ago)
Var is functional scope vs let is block scope: this is so clear now to me .... this is the best thing I learned today. Thank you!
Makako Rehzuz (7 months ago)
Thank you Brad, greetings from México, you are the best teacher!
Lalit Bhatt (7 months ago)
At 25:47 can't we call imAFunctionNotAMethod like this.imAFunctionNotAMethod ?
Vineeth (6 months ago)
I just tried it - didn't work. You can try the following. function imAFunctionNotAMethod(){ console.log(this) } hello.call(imAFunctionNotAMethod) . . . . function imAFunctionNotAMethod(){ console.log(this.firstName) } hello.call(imAFunctionNotAMethod)
svik (7 months ago)
Amazing teaching ability! It's very rare to find such wonderful teaching talent combined with the excellent domain knowledge.
Loralie Flint (7 months ago)
Please Please Please!!!!!, Do a course like this with React. You make things very easy to understand .
Mohammad Shweiki (7 months ago)
Still waiting for day 9, I hope everything is fine *BIG cheers from Dubai*
Stian Maurstad (7 months ago)
You are a great teacher! Thank you.
Roland Pierre Louis (7 months ago)
Will you teach OOP in your premium course Brad ?
Jimmy Liao (7 months ago)
A-HA moment! Thank you tech me a lot!
Balwinder Singh Sohi (7 months ago)
Very Nice Explain Thanks
test (7 months ago)
also, 'functions' and 'methods', how are they different?
Andy Farrell (7 months ago)
A method is just a function that is a property of an object.
test (7 months ago)
is 'block' and 'closure' the same thing?
AHMAD HASSAN (7 months ago)
thank you
Andriy Rukas (7 months ago)
so this is what enlightenment feels like... great video!
webiz fabulous (7 months ago)
awsm , watching from nepal.
John Joseph (7 months ago)
Great lesson!. I would like to ask how's about arrow function with this context?
Raahul Dahal (7 months ago)
ThankYou so much sir...❤
Abhishek Kumar (7 months ago)
Thank u for this awesome video and series
Isshman Garcia (7 months ago)
I think it's very beneficial to learn the most complicated parts of JavaScript first.
NeoSabiit Tehzeeb (7 months ago)
I would like to give 10000000 Like ....is "this" possible in youtube? this is now my friend in JS. Courses From you are asset to the Community.
Jesse McElroy (7 months ago)
Now I just need to tackle the "new" keyword because I am totally lost about that one still.
LearnWebCode (7 months ago)
I have a video on my channel named "What is Object-oriented Programming?" and we use the "new" operator at about the 13 minute mark. Hope it helps!
Jesse McElroy (7 months ago)
I got a lot of insight from this video the .call method made things clearer but what if you wanted to make this point to more than one object from the same call would you just separate the names with a comma like this (John, Sally, Jack) ?
najmantube (7 months ago)
I just tried it - didn't work - - but maybe there's a way of doing it(?). This (obviously) works : create new object 'Jane' - then just duplicate the code and call new object: breathe.call(john) breathe.call(jane)
Mohammad Shweiki (7 months ago)
After 4 years in university, and 2 years of work between teaching and freelance web development, finally I can feel I fully understand the crisis of "this" keyword. great job man (Y)
Hashim Warren (7 months ago)
i should have taken the state-mandated break
LearnWebCode (7 months ago)
Tapas Mondal (7 months ago)
Hi Brad! I am truly grateful to you. I am true fan of way of teaching and your voice. I am eagerly waiting for your full stack course. I loved your other course for git and GitHub. Now I loved git ,github, nodejs ,npm, gulp, webpack and Babel. Thanks a lot for enlighten me and taking me to the web development career.
Tomasz Konecki (7 months ago)
Great explanation! Thanks!
Felix Avelar (7 months ago)
This is mind blowing! Thank you Brad!
Americano Coffee (1 month ago)
Wrong! .this is mindblowing! :)
Mohammad Shweiki (7 months ago)
8 videos down, 2 to go Please make a course on Python "fingers crossed"
J Canan (7 months ago)
Yes, I would love a Python course from Brad too man!!! Brad please!!!
Yeti's Tech Corner (7 months ago)
Very excited when I get notified of a new video excellent teaching style, easy to follow keep up the great work!
Abdisamad Khalif (7 months ago)
The reason why I'm watching this "The 10 Days of JavaScript" video series is that I'm going to skip them in the Udemy Premium Course! :)

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.