소스 검색

Finish logical and or

Signed-off-by: Michael Tang <michael.h.tang@gmail.com>
Michael Tang 5 년 전
부모
커밋
fef4881b47
1개의 변경된 파일29개의 추가작업 그리고 0개의 파일을 삭제
  1. 29 0
      logical-and-or.js

+ 29 - 0
logical-and-or.js

@@ -0,0 +1,29 @@
+let temp = 55
+
+// Logical And Operator -true if both sides are true. False otherwise
+// Logical Or Operator - true if any one is true
+
+if (temp >= 60 && temp <= 90) {
+    console.log('It is pretty nice out!')
+} else if (temp <= 0 || temp >= 120) {
+    console.log('Do not go outside!')
+} else {
+    console.log('Eh. Do what you want.')
+}
+
+// Challenge area
+
+let isGuestOneVegan = false
+let isGuestTwoVegan = false
+
+// Are both vegan? Only offer up vegan dishes
+// At least one vegan? Make sure to offer up some vegan options
+// Else, Offer up anything on the menu
+
+if (isGuestOneVegan && isGuestTwoVegan) {
+    console.log('Only offer up vegan dishes.')
+} else if (isGuestOneVegan || isGuestTwoVegan) {
+    console.log('Make sure to offer up some vegan options.')
+} else {
+    console.log('Offer up anything on the menu.')
+}