JavaScript For In & For Of Loops #JavaScriptJanuary

Channel:
Subscribers:
296,000
Published on ● Video Link: https://www.youtube.com/watch?v=c5a4sNshBA4



Duration: 2:09
17,381 views
738


Watch the entire #JavaScriptJanuary series from the beginning!
https://www.youtube.com/playlist?list=PLkwxH9e_vrALlH7D0XLDn2td-uoHqHFxq

"For In" and "For Of" are ways to loop through objects or arrays.

"For In" loops through property names of an object. Remember that objects are made up of property, or key, value pairs. In order to get the values we will need to reference the original object and use square brackets to define the property.

"For In" will work with an array. Instead of a named property it will use the index of each value. In order to get the values we would have to reference the original array and use square brackets to define the index of the value. A better solution would be to use "For Of".

"For Of" loops iterate through items in a collection such as an array. It’s very similar to the "For In" except this time we are using the “of” keyword and passing it an iterable instead of an object.

So if we use a "For Of" loop with an array then we will not have to reference the original array using indices. It will just give us the values directly.

Note that "For Of" will not work with Objects because they are not iterable. And just remember that “For In” is for Objects and “For Of” is for Arrays.

I'll be releasing a new video every day in January! Stay tuned..
_____________________________________

📚 Learn to CODE in just a FEW months here:
Treehouse Discount Code: https://treehouse.7eer.net/codeSTACKr
_____________________________________

🛠️ Tools I use:
🟠 Theme: https://marketplace.visualstudio.com/items?itemName=codestackr.codestackr-theme
🟠 Font: STACKr Code (Exclusive to my VS Code Course - https://vsCodeHero.com)
🟠 SuperHero Extension Pack: https://marketplace.visualstudio.com/items?itemName=codeSTACKr.superhero-extensions

🚢 Deploy for FREE on Vercel: https://vercel.com/ambassadors/codestackr
_____________________________________

💖 Show support!
PayPal: https://paypal.me/codeSTACKr
_____________________________________

Watch Next:
Web Development - Beginners Roadmap (2020) - https://youtu.be/iogabydg2y0
Playlist: Web Development For Beginners - https://www.youtube.com/watch?v=Ez4yHS2dsN8&list=PLkwxH9e_vrAJ0WbEsFA9W3I1W-g_BTsbt
_____________________________________

Connect With Me:
Website: http://www.codestackr.com
Twitter: https://twitter.com/codeSTACKr
Instagram: https://instagram.com/codeSTACKr/
Facebook: https://facebook.com/codeSTACKr
_____________________________________

** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.

#JavaScriptJanuary #31Days31Videos #codeSTACKr







Tags:
JavaScriptJanuary
31Days31Videos
JavaScript
JS
Web Development
Web Dev
Web Development 2020
Web Dev 2020
HTML
CSS
Node.js
Chrome
ES5
ES6
ES7
javascript for in
javascript for in loop
javascript for of
javascript for of loop
javascript loops
js for in
js for in loop
js for of
js for of loop
js loop
js loops
javascript loop
javascript loop object
javascript loop array
js loop object
js loop array
for in
for of
for in loop
for of loop