Skip to content

Commit 2d5c41d

Browse files
committed
fix- added the explanation
1 parent d563603 commit 2d5c41d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lesson_04/ethanhillman/lesson04

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,14 @@ print(is_even(9)) # Output: False
1010
# return number % 2 === 0;
1111
# }
1212
# console.log(isEven(6)); # Output: true
13-
# console.log(isEven(9)); # Output: false
13+
# console.log(isEven(9)); # Output: false
14+
15+
16+
##Explanation
17+
18+
In Python, the logic expressed as return number % 2 == 0, which evaluates to true or false.
19+
In JavaScript, the same idea is written as return number % 2 ===0, which evaluates to true or false.
20+
The main difference lies in the syntax Python uses def to define functions and print() to display results,
21+
while JavaScript uses the function keyword and console.log() to output results. When tested with the numbers
22+
6 and 9, both versions correctly identify 6 as even and 9 as odd, demonstrating that although the syntax differs
23+
between the 2 languages, the underlying logic is exactly the same.

0 commit comments

Comments
 (0)