# JavaScript 2019-9-26 猜數字遊戲 ### 比較運算子 1. 相同時,回應恭喜猜對 2. 使用者輸入的數字比較小時,回應猜大一點 3. 使用者輸入的數字比較大時,回應猜小一點 ```javascript= ``` Math.random() random integer if ( A === B ), 如果true,\輸出message else if ( A < B ), 如果true,\輸出message else if ( A > B ), 如果true,\輸出message else 對話框輸入數字外,才有造成2個條件皆為false ### 邏輯運算子 1. 晚上7點之後到9點前時 [現在便當店7折] 2. 早上9點和下午3點時顯示 [便當店買一送一] 3. other time [客人要不要買一送一便當] && 運算子 [if the left part of the 條件 is true and the right one is too] than the function will be true [if the left part of the 條件 is true and the right one is not] than the function will be false