Advertisement
Liliana797979

lekcia 2

Nov 29th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function perimeterArea(arg1) {
  2.     let r = Number(arg1);
  3.  
  4.     let calculatedArea = Math.PI * r * r;
  5.     let calculatedParameter = 2 * Math.PI * r;
  6.    
  7.     console.log(calculatedArea.toFixed(2));
  8.     console.log(calculatedParameter.toFixed(2));
  9. }
  10.  
  11. perimeterArea("3");
  12.  
  13. function weather(arg1) {
  14.     let weather = arg1;
  15.     if (weather == "sunny") {
  16.         console.log(`It's warm outside!`);
  17.    } else if (weather == "cloudy") {
  18.        console.log(`It's cold outside!`);
  19.     } else {
  20.         (weather == "snowy")
  21.         console.log(`It's cold outside!`);
  22.    }
  23. }
  24.  
  25. weather("snowy");
  26.  
  27.  
  28. function weather2(arg1) {
  29.    let degrees = Number(arg1);
  30.    if (degrees >= 26 && degrees <= 35) {
  31.        console.log("Hot");
  32.    } else if (degrees >= 20.1 && degrees <= 25.9) {
  33.        console.log("Warm");
  34.    } else if (degrees >= 15.00 && degrees <= 20.00) {
  35.        console.log("Mild");
  36.    } else if (degrees >= 12.00 && degrees <= 14.9) {
  37.        console.log("Cool");
  38.    } else if (degrees >= 5.00 && degrees <= 11.9) {
  39.        console.log("Cold");
  40.    } else {
  41.        console.log("unknown");
  42.    }
  43. }
  44.  
  45. weather2(0);
  46.  
  47.  
  48. function isExcellent(arg1) {
  49.    let evaluation = Number(arg1);
  50.    if (evaluation >= 5.50) {
  51.        console.log("Excellent!");
  52.    }
  53. }
  54.  
  55. isExcellent("5");
  56.  
  57.  
  58. function number(arg1, arg2) {
  59.    let a = Number(arg1);
  60.    let b = Number(arg2);
  61.    if (a > b) {
  62.        console.log(a);
  63.    } else {
  64.        console.log(b);
  65.    }
  66. }
  67.  
  68. number("-5", "3");
  69.  
  70.  
  71. function evenOrOdd(arg1) {
  72.    let n = Number(arg1);
  73.    if (n % 2 == 0) {
  74.        console.log("even");
  75.    } else {
  76.        console.log("odd");
  77.    }
  78. }
  79.  
  80. evenOrOdd("2");
  81.  
  82.  
  83. function nums100To200(arg1) {
  84.    let n = Number(arg1);
  85.    if (n < 100 ) {
  86.        console.log("Less than 100");
  87.    } else if (n <= 200) {
  88.        console.log("Between 100 and 200");
  89.    } else {
  90.        console.log("Greater than 200");
  91.    }
  92. }
  93.  
  94. nums100To200("250");
  95.  
  96.  
  97. function password(arg1) {
  98.    let password = arg1;
  99.    if (password == "s3cr3t!P@ssw0rd") {
  100.        console.log("Welcome");
  101.    } else {
  102.        console.log("Wrong password!");
  103.    }
  104. }
  105.  
  106. password("s3cr3t!P@ss");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement