GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Updated Logical Comparison · FarajDEV/javascript-2@ee9ad92

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • conditional
    • comparators.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎conditional/comparators.md‎

Copy file name to clipboardExpand all lines: conditional/comparators.md
+8Lines changed: 8 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Other conditional test:
1515
* ```x > a```: is x bigger than a?
1616
* ```x < a```: is x less than a?
1717
* ```x <= a```: is x less than or equal to a?
18+
* ```x >=a```: is x greater than or equal to a?
1819
* ```x != a```: is x not a?
1920
* ```x```: does x exist?
2021

@@ -44,3 +45,10 @@ assert(a === 10);
4445
```
4546

4647
---
48+
##Logical Comparison
49+
In order to avoid the if-else hassle, simple logical comparisons can be utilised.
50+
51+
```js
52+
var topper = (marks > 85) ? "YES" : "NO";
53+
```
54+
In the above example, `?` is a logical operator. The code says that if the value of marks is greater than 85 i.e. `marks > 85` , then `topper = YES` ; otherwise `topper = NO` . Basically, if the comparison condition proves true, the first argument is accessed and if the comparison condition is false , the second argument is accessed.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.