Spocoman

09. Weather Forecast

Dec 8th, 2021 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function weatherForecast(input) {
  2.  
  3.     let weather = input[0];
  4.    
  5.     if (weather === "sunny") {
  6.         console.log("It's warm outside!");
  7.     } else {
  8.         console.log("It's cold outside!");
  9.     }
  10. }
  11.  
  12. ИЛИ ТАРИКАТСКАТА С ТЕРНАРЕН ОПЕРАТОР:
  13.  
  14. function weatherForecast(input) {
  15.  
  16.     console.log(`It's ${input[0] === "sunny" ? "warm" : "cold"} outside!`);
  17. }
Add Comment
Please, Sign In to add comment