Skip to content

Commit

Permalink
updating
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaByte committed Feb 14, 2024
1 parent 669cb90 commit 167a516
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
29 changes: 29 additions & 0 deletions courses/if-statements/returning-boolean-values-from-functions.md
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;
}
```
4 changes: 3 additions & 1 deletion islands/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export default function ProgressBar(props: { progress: number }) {
const widthStyle = { width: `${props.progress}%` };
// min default must be 5 for better style
const defultWidth = (props.progress < 5 && props.progress > 0) ? 5 : props.progress;
const widthStyle = { width: `${defultWidth}%` };
return (
<div className="bg-base-100 rounded-box shadow-sm overflow-hidden p-1">
<div className="relative h-6 flex items-center justify-center">
Expand Down
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))
5 changes: 5 additions & 0 deletions routes/group/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export default function CoursePage(props: PageProps<Props>) {
</a>
))}
</div>
<div class="flex w-full">
<a title="العودة الى صفحة الدروس" href="/courses" class="underline mt-4">
العودة الى صفحة الدروس
</a>
</div>
</div>
</div>
<Footer />
Expand Down
5 changes: 4 additions & 1 deletion static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ mark::before {
background-color: oklch(var(--b3));
background-repeat: no-repeat;
background-position: 50%;
border-radius: 0.2rem;
height: 99%;
margin-top: 4px;
}

.gutter::before {
Expand Down Expand Up @@ -186,7 +189,7 @@ body::-moz-scrollbar-thumb {

.copy-button {
background-color: oklch(var(--bc)/0.2);
padding: 5px;
padding: 3px;
border-radius: 0.2rem;
position: absolute;
top: 5px;
Expand Down

0 comments on commit 167a516

Please sign in to comment.