[Fix] correct Guide article example for Iterate Through the Keys of an Object with a for...in Statement (#35197)
* fix: added dot btwn [user] and online * fix: corrected example for other languages
This commit is contained in:
@@ -12,23 +12,29 @@ localeTitle: يتكرر عبر مفاتيح كائن مع لـ ... في بيا
|
||||
|
||||
### مثال 1:
|
||||
|
||||
`for (let user in obj) {
|
||||
if(obj.user.online === true) {
|
||||
//code
|
||||
}
|
||||
}
|
||||
`
|
||||
```javascript
|
||||
|
||||
for (let user in obj) {
|
||||
if(obj.user.online === true) {
|
||||
//code
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
* يوضح المثال 2 كيفية استخدام الترميز `[square-bracket]` في تنفيذ الشفرة.
|
||||
|
||||
### المثال 2:
|
||||
|
||||
`for (let user in obj) {
|
||||
if(obj[user]online === true) {
|
||||
//code
|
||||
}
|
||||
}
|
||||
`
|
||||
```javascript
|
||||
|
||||
for (let user in obj) {
|
||||
if(obj[user].online === true) {
|
||||
//code
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### حل:
|
||||
|
||||
|
Reference in New Issue
Block a user