-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
courses/if-statements/returning-boolean-values-from-functions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: إرجاع القيم المنطقية من الوظائف | ||
snippet: لا يوجد | ||
order: 9 | ||
--- | ||
|
||
قد تتذكر من المقارنة مع عامل المساواة أن جميع عوامل المقارنة تُرجع قيمة منطقية | ||
صحيحة أو خاطئة. | ||
|
||
في بعض الأحيان يستخدم الأشخاص عبارة `if/else` لإجراء مقارنة، مثل هذا: | ||
|
||
```js | ||
function isEqual(a, b) { | ||
if (a === b) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
``` | ||
|
||
ولكن هناك طريقة أفضل للقيام بذلك. بما أن `===` تُرجع `true` أو `false`، فيمكننا | ||
إرجاع نتيجة المقارنة: | ||
|
||
```js | ||
function isEqual(a, b) { | ||
return a === b; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
precodes/if-statements/returning-boolean-values-from-functions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function isEqual(a, b) { | ||
return a === b; | ||
} | ||
|
||
console.log(isEqual(5, 5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters