#21 For in loop in JavaScript

  Рет қаралды 86,550

Telusko

Telusko

Күн бұрын

Пікірлер: 253
@aravind2377
@aravind2377 2 жыл бұрын
Answer for 3:28 , I have used in my coding with help of phones instead of laptop. let alien = { name : 'Chandramouli', tech : 'Javascript', phones : { android_version : '11', ram : '4', brand1 : 'mi' } } for(let key in alien.phones) { console.log(key, alien.phones[key]); } Output : android_version 11 ram 4 brand1 mi
@teenskeey2157
@teenskeey2157 2 жыл бұрын
Nice one🙌
@muhidshaikh6446
@muhidshaikh6446 Жыл бұрын
@kolaraju8114
@kolaraju8114 Жыл бұрын
Thank you
@apoorv1441
@apoorv1441 2 жыл бұрын
to get keys of laptop key : for(let key in alien.laptop){ console.log(key) } to get values of laptop keys : for(let key in alien.laptop){ console.log(alien.laptop[key]) } //Alternative for(let key in alien["laptop"]){ console.log(key) }
@almajose4396
@almajose4396 9 ай бұрын
M
@SalmanulFaris-zv6qy
@SalmanulFaris-zv6qy 5 ай бұрын
this will only print the values of properties eg: i7,4, asus
@WenboWang-u8b
@WenboWang-u8b 2 күн бұрын
for(let key in alien['laptop']){ console.log(key, alian['laptop'][key]) }does it work.
@muskangupta680
@muskangupta680 Жыл бұрын
let Employee={ name:"Muskan", age:22, course:{ main_subjects:'Mathematics', 'minor subject':'English'} }; for (let key in Employee.course){ console.log(key,Employee.course[key]); } output:- main_subjects Mathemaics minor subject English
@bonnyrogny241
@bonnyrogny241 Жыл бұрын
its correct😶
@kheiromahiout7483
@kheiromahiout7483 Жыл бұрын
The answer of 3.38 is: For(let key in alien["laptop"]{ Console.log(key, alien.laptop[key])}
@sandeepprabhakula7714
@sandeepprabhakula7714 3 жыл бұрын
for(let key in alien.laptop){ console.log(key,alien.laptop[key]); } I think it should work
@santoshsuryavamshi888
@santoshsuryavamshi888 3 жыл бұрын
Good it's working.
@sshreeeditz640
@sshreeeditz640 3 жыл бұрын
Its working. Spr👏
@nocontentshere8116
@nocontentshere8116 3 жыл бұрын
for(let key in alien){ console.log(key,alien.laptop.key); } might think this will also work. and in for don't need to denote the inside object, can directly take whole object
@sandeepprabhakula7714
@sandeepprabhakula7714 3 жыл бұрын
@@nocontentshere8116 yes it will work
@tomasmatusek6292
@tomasmatusek6292 3 жыл бұрын
waw
@adithya1577
@adithya1577 9 ай бұрын
At 3:28 let alien = { name :'Adithya', language: 'JS', exp :'Fresher', laptop : { cpu : 'i3', ram : '4', brand : 'hp' } } for (key in alien.laptop){ console.log(key,alien.laptop[key]); }
@mdirfanmullick
@mdirfanmullick 3 жыл бұрын
Very nice series, Navin. I binge watched it in 2 hours it was so exciting ☺️ please keep it on. Waiting for the next one
@deepalibiradar3684
@deepalibiradar3684 2 жыл бұрын
Your teaching technique is really adorable...you made my day... 🤩 A million thanks to you ❤️🙏
@Excel-zu5iv
@Excel-zu5iv 2 жыл бұрын
I came back from the last video, here is my shortcut code: (it works even if the object has multiple objects in it): function key_printer(obj, spaces = '') { for(keys in obj) { if(typeof obj[keys] != 'object') { console.log(spaces + keys); } else { console.log(spaces + keys); key_printer(obj[keys], spaces + ' ') } } } key_printer(objects) //Note: The word 'objects' is the object name. This works...
@DesiVillagerEurope
@DesiVillagerEurope 10 ай бұрын
Oh why did i see this only now . Great teacher . Great sir
@lathavoggu2639
@lathavoggu2639 3 жыл бұрын
3:31 for( let key in alien){ if( typeof (alien[key]) === 'object') { for(let key1 in alien[key]){ console.log(key1, alien[key][key1]); } }else console.log(key, alien[key]); }
@__________________________6910
@__________________________6910 3 жыл бұрын
Great
@blackpanther-vr6yj
@blackpanther-vr6yj 3 жыл бұрын
Thanks
@maverick_8707
@maverick_8707 Жыл бұрын
to print the value of the object we can do this for (const key in alien) { if (Object.hasOwnProperty.call(alien, key)) { const element = alien[key]; console.log(element); } }
@shivampathak1405
@shivampathak1405 Жыл бұрын
Answer for 3:28 || for (key in alien.laptop) { console.log(key, alien.laptop[key]) }
@omatsoladev
@omatsoladev 3 жыл бұрын
thanks so much Navin, i am loving the series , i took your python course and i enjoyed it. you know how to simplify everything to make it possible for us to learn. thank you so much
@yazor8716
@yazor8716 3 жыл бұрын
for (let key in alien) { if (typeof alien[key] === "object") { for (let key2 in alien[key]) { console.log(key2, alien[key][key2]) } } else console.log(key, alien[key]) } I run it, it works :) Edit: I might have misunderstood the objective. Not sure if we were supposed to print the inner object's properties only. In any case, this program prints the properties of both objects.
@bhumit070
@bhumit070 3 жыл бұрын
yes it is okay, but better to wrap it inside function you can see my comment
@yazor8716
@yazor8716 3 жыл бұрын
@@bhumit070 I am assuming you made it recursive so that it can print multiple nested objects, right? Good thinking!
@tomasmatusek6292
@tomasmatusek6292 3 жыл бұрын
realy good waw.Something like that I was try find, u are good.
@tomasmatusek6292
@tomasmatusek6292 3 жыл бұрын
that is realy perfect and is interesting that if you dont use alien[key],only alien[key2]it not work good, so you must use alien[key][key2], that is realy interesting. And same thanks for this else, realy good if we dont have objects in laptops, GJ bro.
@tomasmatusek6292
@tomasmatusek6292 3 жыл бұрын
can you share with me where you get the idea about key1 and key2?
@gbolahanalaba
@gbolahanalaba 8 ай бұрын
To print only laptop for(let key in alien.laptop) console.log(key, alien.laptop[key])
@subhrajitjana736
@subhrajitjana736 2 жыл бұрын
3:30 --> let alien = { name: "subham", tech: "JS", laptop: { cpu: "I7", RAM: 8, brand: "Asus", } } for(let key in alien.laptop) { console.log(key, alien.laptop[key]); }
@Dattasai-h8u
@Dattasai-h8u 28 күн бұрын
let cs = { student:"Datta Sai", subjects:"ui design", profesors:{ui_design_class:"Andrue",intro_to_networking_class:"Ajay"} } for(let key in cs){ console.log(key,cs[key]) } for(let key1 in cs.profesors){ console.log(key1,cs.profesors[key1]) }
@sprinter5901
@sprinter5901 Жыл бұрын
Answer for 3:28 Can be a bit overwhelming for beginners: let alien = { name: "Navin", tech: "JS", laptop:{ cpu: "i7", ram: 4, brand: "asus" } } for(let key in alien){ switch(key){ case"laptop": for(let key2 in alien["laptop"]){ console.log(key2, alien["laptop"][key2]); } default: if(key === "laptop"){ break; } else{ console.log(key, alien[key]); } } }
@gowthammanikandan2563
@gowthammanikandan2563 3 жыл бұрын
The main thing I learnt from you was. Learn How to learn.😇
@gobinathpalanisamy5450
@gobinathpalanisamy5450 Жыл бұрын
When can handle multiple inner objects by the following example program let alien={ name:"gobi", role:"lead", laptop:{ brand1:"mac", version:"pro" }, loc:"chennai" } for(let key in alien){ value= alien[key]; if (typeof value== "object") { for(let innerkey in value) { console.log( key, innerkey, value[innerkey]) } } else{ console.log( key, alien[key]) } }
@akhiljoy4268
@akhiljoy4268 Жыл бұрын
let alien = { name: 'joy', technology : 'Js', laptop : { ram : ' 4 ' , hardisk : ' hdd' , brand : 'lenovo' } } for(let key in alien.laptop) { console.log(key, alien.laptop[key]); }
@sakshamverma5472
@sakshamverma5472 Жыл бұрын
You are correct brother
@coderom8192
@coderom8192 3 жыл бұрын
for (const i in alien.laptop) { console.log(i+" -> "+alien.laptop[i]); } Love Telusko Learning ❤️
@vinykp5128
@vinykp5128 Жыл бұрын
let Employee={ name:'vinayak', native:'haveri', collage:{ collage_name:'GECK', Branch:'mech' } } for(let key in Employee.collage){ console.log(key,Employee.collage[key]); } ------output is ----- collage_name GECK Branch mech
@gandamraviteja7019
@gandamraviteja7019 Жыл бұрын
for(let key in alien.laptop){ console.log(key,alien.loptop[key]); } console.log("Done myAlien"); Thank you for helping us to grow❤
@prasad4you57s2
@prasad4you57s2 3 жыл бұрын
let prasad = { name : 'prasad', age : 30, laptop: { ram : 200, brand1:'asus' } } for(let key in prasad){ console.log(key, prasad[key]) if(key==='laptop'){ for(let n in prasad[key]){ console.log(n, prasad[key][n]) } } }
@emrandavid4851
@emrandavid4851 Жыл бұрын
3:28 thsi is the easiest way to print out let data ={ name:'emran', grade:12, sex:'m', //another dict for laptops laptop:{ brand:'hp', ram:16, cpu:'r9', } } for (let key in data.laptop) { console.log(key,data.laptop[key]) }
@dheerajg147
@dheerajg147 8 ай бұрын
3:28 answer let aliean = { name : 'navin', tecj: 'js', 'work exp' : 5, laptop : { cpu : 'i7', ram : 4, brand : 'asus' } } for (let key in aliean.laptop) { console.log(key, aliean.laptop[key]); }
@PraveenKumar-sk5sd
@PraveenKumar-sk5sd 3 жыл бұрын
a={ name:'praveen', department:'ECE', NCC:{ drill:'good', comm:'excellent' } } for(let as in a) { console.log(as,a[as]) } for(let i in a['NCC']) { console.log(i,a['NCC'][i]) }
@UmeshchandrareddyGS
@UmeshchandrareddyGS 2 жыл бұрын
Bro channel Peru adhirindhi😊🥰 thelsukunnaaaaam bro👍🤝
@mdzaid6422
@mdzaid6422 3 жыл бұрын
for(let key in alien){ if(key == 'laptop'){ for (const key in alien.laptop) console.log(key,alien.laptop[key]) } else console.log(key, alien[key]); }
@tsa_vibes
@tsa_vibes 3 жыл бұрын
for(let key in alien['laptop']) { console.log(key, alien.laptop[key]); } output: cpu i7 ram 4 brand Asus
@RAVISINHA-jd9wq
@RAVISINHA-jd9wq 3 жыл бұрын
For ( key in alien[laptop.key] ) Console. Log( key )
@patelronak153
@patelronak153 3 жыл бұрын
for(key in alien.laptop){ console.log(key, alien.laptop[key]) }
@rayanjames3050
@rayanjames3050 Жыл бұрын
Thank you Navin🎉🎉❤
@vineethyepuri5877
@vineethyepuri5877 2 жыл бұрын
Answer 3:39 let a={ name:"vineeth", 'work space':4, laptop:{ ram:4, } } for(let i in a.laptop) console.log(i,a.laptop[i]) output: ram 4
@vamshi_vemula
@vamshi_vemula 3 жыл бұрын
It's like for each loop in java . Btw Thanks for JS
@venkatathanmayiyanaparti73
@venkatathanmayiyanaparti73 3 жыл бұрын
Sir I am class 11 student what is the best computer language to learn? But I started learning python from ur channel is that good
@Leo-qo5hk
@Leo-qo5hk 3 жыл бұрын
Start with C programming then C++ then data structures with C and then you will find easy to learn any programming languages
@maheerathore7847
@maheerathore7847 3 жыл бұрын
@Cool Edits good things bro
@vasantkumarks9351
@vasantkumarks9351 Жыл бұрын
let dinga = { name : 'vasant', add : 'tmk', laptop :{ cpu : 'i5', brand1 : 'dell', } } For fetching the inner object details Answer 👇👇 for(let key in dinga.laptop) { console.log(key, dinga.laptop[key]); }
@rohanbankar4395
@rohanbankar4395 2 жыл бұрын
let stud = { studName:'Rohan', class: 'A', subject:{ sub1:'AJP', sub2:'DBMS', sub3:'OOP', } } for(let key in stud.subject){ console.log(key,stud.subject[key]); }
@beastmode373
@beastmode373 2 жыл бұрын
let user={ name: "john", id:"ugr/111/12", school:{ dep1:"cse", dep2:"com", dep3:"power", } } for(let key in user.school){ console.log(key,user.school[key]) }
@sahra.004
@sahra.004 Жыл бұрын
let alien = { name :'sepid', tech :'JS', laptop : { cpu:'i7', ram: 4, brand: 'asus', } } for (let key in alien.laptop) { console.log(key, alien.laptop[key]) } this code leads to displaying the key values of the object which is inside alien object.
@hvardhan55
@hvardhan55 Жыл бұрын
3:40 //code for printing laptop keys along with their value for(let key in alien.laptop){ console.log(key,alien.laptop[key]) }
@maneshrao7416
@maneshrao7416 3 жыл бұрын
Thank you Naveen Sir!!!
@kavinsg8035
@kavinsg8035 6 ай бұрын
for (let key in alien.laptop) { console.log(key,alien.laptop[key]) } output: { name: 'kavin', technology: 'JS', 'years exp': 4, laptop: { brand: 'hp', cpu: 'i5-intel' } } brand hp cpu i5-intel
@44syagneshwar
@44syagneshwar 3 жыл бұрын
It is so helpful 🍀 thank you brother
@abhishekpuram5827
@abhishekpuram5827 Жыл бұрын
answer for 3:28 let alien = { name: 'abhi', tech: 'js', laptop:{ cpu:'i7', ram:4, brand:'asus' } } for(let key in alien.laptop) { console.log(key,alien.laptop[key]); }
@ShriGuruDevoBhava
@ShriGuruDevoBhava 2 жыл бұрын
for (let key in alien) { if (typeof alien[key]==='object'){ for (let t in alien[key]) { console.log(alien[key][t]); } } }
@muzammil9482
@muzammil9482 Жыл бұрын
answer asked for the question at 3.28 for( let key in alien.laptop){ console.log(key, alien.laptop[key]); //print key and corresponding value }
@ngawangtashi326
@ngawangtashi326 Жыл бұрын
to show all key value pair then use this:- let alien = { name : 'Ngawang', tech : 'phones', phones : { android_version : '12', ram : '8', brand1 : 'OnePlus' } } for(let key in alien){ console.log(key, alien[key]); } for(let key in alien.phones){ console.log(key, alien.phones[key]); }
@hariprasad-gc8bz
@hariprasad-gc8bz 3 жыл бұрын
Navin wanted to know how we will reduce the code in keep it in the same loop, I have tried but getting the first object value and all sending aboject values, repeating same until the loop exit.
@batambuzestephen8243
@batambuzestephen8243 9 ай бұрын
@3:30 I used "p" instead of key. The for in loop statement is; for(let p in Alien.laptop){ console.log(p, Alien.laptop[p]); }
@nirusanhariharan8382
@nirusanhariharan8382 3 жыл бұрын
I enjoyed the content of for in loop sir thx
@karthikchowdaryynunna5382
@karthikchowdaryynunna5382 Жыл бұрын
let cricket={ player_name:"virat", jerseyno:18, ground:{ staff:10, area:'tenyards', } } for(let key in cricket.ground) { console.log(key,cricket.ground[key]); }
@arashautomationlab9088
@arashautomationlab9088 2 жыл бұрын
for(print in alien.laptop){ console.log(print, alien.laptop[print]) }
@meerfulzele5569
@meerfulzele5569 2 жыл бұрын
ANSWER FOR 3:28 let alien = { name : 'Meer', tech : 'JS', laptop : { cpu : 'i5', ram : '8GB', brand : 'HP' } } for(let key in alien.laptop) { console.log(key,alien.laptop[key]); } LIKE IF THESE IS CORRECT😁
@SriRajendraTuraga
@SriRajendraTuraga Жыл бұрын
03:31 for(let key in alien['laptop']){ console.log(key,alien.laptop[key]); }
@ritiksinha7078
@ritiksinha7078 Жыл бұрын
let alien ={ name : 'jaadu', height : 3, colour : 'blue', friends : { male : 5, female : 1, alien : 0 } } for(let key in alien.friends) { console.log(key,alien.friends[key]); }
@navyasri3987
@navyasri3987 2 жыл бұрын
3:28 for(let key in alien.laptop) { console.log(key,alien.laptop[key]) }
@AmeerMuawia-i4p
@AmeerMuawia-i4p 2 ай бұрын
let Student= { Name : 'Ameer', Tec : 'JS', City : 'Grw', laptop : { cpu : 'i7', ram : 4, brand : 'dell' } } for(let key in Student.laptop){ console.log(key, Student.laptop[key]) }
@divyanshajain5140
@divyanshajain5140 3 жыл бұрын
let alien = { name: "Divyansha", tech : "JS", laptop: { cpu : 'i7', ram : '4', brand : 'Asus' } } for(let key in alien.laptop){ console.log(key,alien.laptop[key]); }
@gambo2003
@gambo2003 3 жыл бұрын
Very good content thanks mr
@tgnsparvathi4774
@tgnsparvathi4774 2 жыл бұрын
assignment let user = { name : "parvathi", id: 2341, laptop : { version : "i3", brand : "hp", } } for(let key in user.laptop){ console.log(key, user.laptop[key]); } version i3 brand hp
@adityashaw6777
@adityashaw6777 Жыл бұрын
ANSWER OF HW Q let i='name' let a={name: 'adi',tech:'js', laptop:{ brand:'HP', ram:'8 gb', cpu:'i7' }}; for(let key in a.laptop) { console.log(key+":"+a.laptop[key]) }
@darkhell7357
@darkhell7357 Жыл бұрын
let alien = { name: 'Suman', skillset: 'webdeveloper', work_exp : 5, laptop :{ cpu : 'core2duo', RAM : '4 gb', Brand : 'Lenevo' } } //for(let key in alien) for (let key in alien.laptop) { console.log(key, alien.laptop[key]); }
@justinram433
@justinram433 Жыл бұрын
let count = 1; let alien = { name : 'Justin', tech : 'js', laptop : { brand : 'mac', cpu : 'm1', ram : 8 } } for(let key in alien){ if(count==3){ break; } console.log(key, alien[key]); count++; } for(let key in alien.laptop){ console.log(key, alien.laptop[key]); }
@pooja6380
@pooja6380 3 жыл бұрын
Thank you sir your videos are really helpfull 🙏❤
@AnkitSingh-bm4zc
@AnkitSingh-bm4zc Жыл бұрын
Pur😂😂
@saiprakash2206
@saiprakash2206 3 жыл бұрын
for(let key in alien.laptop){ console.log(key, alien.laptop[key]) }
@iamdanyaal
@iamdanyaal 3 жыл бұрын
Thank You Sir
@midhunramesh6828
@midhunramesh6828 3 жыл бұрын
let input='brand' let alien={ name:'Navin', tech:'js', laptop:{ brand:'hp', Cpu:'i7', ram:'8' } } for(let key in alien){ console.log(key,alien[key]) } for (let key in alien.laptop){ console.log(key,alien.laptop[key]) }
@javeedshaik3371
@javeedshaik3371 2 жыл бұрын
let alien ={ name:'Javeed', tech:'JS', laptop:{ cpu:'i7', ram:4, brand:'Lenovo' } } for(let key in alien['laptop']){ console.log(key,alien['laptop'][key]); }
@soumyajitbanerjee1440
@soumyajitbanerjee1440 3 жыл бұрын
for(let s in alien.laptop) { console.log(s,alien.laptop[s]) }
@jno1lilno
@jno1lilno 2 жыл бұрын
let brotha = { name:"jerm", technology:"javascript", laptop : { cpu : "I7", ram : "4", brand : "Asus", } } for( let key in brotha.laptop) { console.log( key, brotha.laptop[key] ) I used brotha instead of alien but I messed up a little
@ritikkhandelwal1549
@ritikkhandelwal1549 3 жыл бұрын
navin sir can you please make tutorial of API using Swagger
@manikanta-p9q
@manikanta-p9q Жыл бұрын
assignment for(let key in alien.laptop) { console.log(key , alien.laptop[key]); }
@hemanthdaduva2870
@hemanthdaduva2870 2 жыл бұрын
printing all the properties of the laptop for(let key in alien.laptop) { console.log(key,alien.laptop[key]); }
@steffqing
@steffqing 2 жыл бұрын
I am getting an error Cannot read properties of undefined (reading 'Luke' [it's the first object])
@25prathammadhani59
@25prathammadhani59 3 жыл бұрын
3:26 for(let key in alien.laptop) { console.log(key, alien.laptop[key]); } //Output:- cpu 17 ram 4 brand Asus
@21P255SWATHIKAG
@21P255SWATHIKAG 7 ай бұрын
const Alien = { name : "swathika" , tech : "JS" , laptop : { cpu : "i7" , storage : "8GB" , Ram : "128" } } for(let key in Alien.laptop){ console.log(Alien.laptop[key]); }
@prayagrajsoni7464
@prayagrajsoni7464 3 жыл бұрын
Sir u are really great
@sahil-dogra
@sahil-dogra 2 жыл бұрын
For( let key in alien. laptop) { Console.log(key, alien.laptop[key]); }
@subodhthore6454
@subodhthore6454 3 жыл бұрын
for (let key in alien.laptop) { console.log(key," ",alien.laptop[key]) }
@hackymilacky
@hackymilacky 11 ай бұрын
the challenge solution: to access the list from laptop let alien = { name:'jerome', tech:'js', laptop: { brand:'mac', cpu:'fast', ram:'a lot' } } for (let key in alien.laptop) { console.log(key, alien.laptop[key]) }
@jayaprakashnarayanaraavi9424
@jayaprakashnarayanaraavi9424 3 жыл бұрын
Let student ={ name:"jaya prakash", roll:245, gadgets:{ mobile:"redmi", lap:"hp", earphones:"boat" }, }; for(i in student) { if (type of student[i]=="object ") { for(x in student[i]) { console.log(x, student[i][x]); } } else console.log(i,student[i]); }
@bhanuprakashreddy8477
@bhanuprakashreddy8477 2 жыл бұрын
3:27 Answer is Here let alien={ name:"bhanu", tech:"JS", laptop:{ cpu:'i9', ram:4, brand:'hp' } } for (let hi in alien.laptop) { //console.log(hi) //for Key Value console.log(hi,alien.laptop[hi]) }
@gobinathpalanisamy5450
@gobinathpalanisamy5450 2 ай бұрын
Without hardcode: let alien = { name: "Gobi", Job: "IT", Laptop: { brand: "mac", size: 16 } }; // Iterate over the keys of the alien object for (let key in alien) { console.log(key, alien[key]); // Check if the value of the current key is an object if (typeof alien[key] === 'object' && alien[key] !== null) { // Iterate over the keys of the nested object for (let nestedKey in alien[key]) { console.log(nestedKey, alien[key][nestedKey]); } } }
@NaveenKumar-hy5et
@NaveenKumar-hy5et 2 жыл бұрын
for( var key in alien.loptop) { console.log(key, alien.loptop[key]); }
@barbarasanchezvasquez2242
@barbarasanchezvasquez2242 2 жыл бұрын
Thanks.
@kalyanimathur5423
@kalyanimathur5423 Жыл бұрын
Timestamp 3:30 let alien = { name: 'Navin', tech: 'JS', laptop: { cpu: 'i7', ram: 4, brand:'Asus', make: 'India' } } for (let key in alien.laptop){ console.log(key,alien.laptop[key]); } //Output cpu i7 ram 4 brand Asus make India
@bhumit070
@bhumit070 3 жыл бұрын
I think this is the right answer function printObj(obj) { for (let key in obj) { if (typeof obj[key] === 'object') { printObj(obj[key]); } else { console.log(key, obj[key]); } } } const person = { name: 'Javascript', age: 25, laptop: { brand: 'Lenovo', screen_size: '14inch', processor: 'AMD Ryzen 5', }, passion: 'Web Dev', }; printObj(person)
@ruthvikparate3421
@ruthvikparate3421 3 жыл бұрын
for (let key in user.laptop) { console.log(key, user.laptop[key]); }
@shubhamagarwal6231
@shubhamagarwal6231 2 жыл бұрын
3:45 --> let alien={ name : 'xyz', tech : 'JS', laptop : { cpu:'i7', ram:16, brand:'Asus' } } for(key in alien.laptop){ // console.log(key,alien[key]); console.log(key,alien.laptop[key]); }
@rohithkumar4498
@rohithkumar4498 3 жыл бұрын
for (let key in alien.laptop) { console.log(key,alien.laptop[key]); }
@coolgirlsharu
@coolgirlsharu 3 жыл бұрын
In JavaScript foreach and for in both are same?
@jayantamondal3242
@jayantamondal3242 Жыл бұрын
let input = 'agee'; let tech = { name : 'JS', age : { from : 1995, to: 2023 }, laptop : { brand : 'Dell', processor : 'AMD', conif : { ram : '8gb', storage : { type : 'SSD', amount : 512 } } } } function innerObjects(objects) { for(let key in objects) { console.log(key); if(typeof objects[key] === 'object') { innerObjects(objects[key]); } } } innerObjects(tech);
@komaduraisamidurai7551
@komaduraisamidurai7551 2 жыл бұрын
for (let key in alien.laptop) console.log(key,alien.laptop[key]) its working but getting only laptop key values i dont know how to print all the values
@tsheringyangden8576
@tsheringyangden8576 Жыл бұрын
let object={ name:"Tshering", enRoll:66, gadgets:{ laptop: "Dell", Phone:'Oppo' } } for(let p in object.gadgets){ console.log(p, object.gadgets[p]); }
@falcon04v8
@falcon04v8 2 жыл бұрын
// fetching data by using "for in loop" let identity = { name : 'Niel', job : 'developer', 'work exp' : '3years', 'device uses' : { laptop_brand : 'Asus', RAM : '32 Gb', CPU : 'intel i9' } } console.log("printing key of identity"); for(let i in identity){ console.log(i); } console.log(" printing key and value of identity"); for(let i in identity){ console.log(i, identity[i]); } console.log(" printing key and value of device uses"); for(let i in identity['device uses']){ console.log(i, identity['device uses'][i]); }
@inmermoiseszorrillagonzale3290
@inmermoiseszorrillagonzale3290 2 жыл бұрын
3:26 Answer let alien = { name: "Navin", tech: "JS", laptop: { cpu: "i7", ram: 4, brand: "asus", }, }; for (let key in alien) { console.log(key, alien[key]); } const laptopObject = alien.laptop; for (let keyName in laptopObject) { console.log(keyName, laptopObject[keyName]); }
@harmanchandel1801
@harmanchandel1801 3 жыл бұрын
👍👍👍
#22 Functions in JavaScript
5:05
Telusko
Рет қаралды 96 М.
For in and for of loop in javascript
7:03
Hitesh Choudhary
Рет қаралды 57 М.
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 64 МЛН
CAN YOU DO THIS ?
00:23
STORROR
Рет қаралды 47 МЛН
The Singing Challenge #joker #Harriet Quinn
00:35
佐助与鸣人
Рет қаралды 12 МЛН
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 8 МЛН
JavaScript Loops Made Easy
10:52
codeSTACKr
Рет қаралды 172 М.
#20 Complex Object, Delete Property in JavaScript
9:35
Telusko
Рет қаралды 89 М.
Learn JavaScript FOR LOOPS in 5 minutes! 🔂
5:45
Bro Code
Рет қаралды 42 М.
Easy Ways to Loop Over Objects in JavaScript
11:21
dcode
Рет қаралды 11 М.
Array Method filter map reduce
9:35
Telusko
Рет қаралды 69 М.
#8 Type Conversion & Coercion in JavaScript
12:53
Telusko
Рет қаралды 134 М.
#29 Why it is called THIS?
11:27
Telusko
Рет қаралды 66 М.
For Loops - Beau teaches JavaScript
6:37
freeCodeCamp.org
Рет қаралды 96 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 64 МЛН