for...in Loop (ऑब्जेक्ट के लिए)
हिंदी व्याख्या: for...in loop ऑब्जेक्ट की keys (properties) पर लूप चलाने के लिए इस्तेमाल होता है।
English Explanation: for...in is used to loop through the properties (keys) of an object.
let student = { name: "Rahul", age: 20, city: "Delhi" };
for (let key in student)
{
document.write(key + " = " + student[key] + "<br>");
}
Output:-
name = Rahul
age = 20
city = Delhi
बिना for...in के:-
let student = {
name: "Rahul",
age: 20,
city: "Delhi"
};
document.write(student.name + "<br>");
document.write(student.age + "<br>");
document.write(student.city);
Output:-
Rahul
20
Delhi