Vassil_Iliev

beggining

Apr 27th, 2022
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Excellent result
  2.  
  3. function nadyaObichaVasko(input) {
  4.     let x = Number(input[0]);
  5.     if (x >= 5.5)
  6.  
  7.         console.log('Excellent!');
  8. }
  9.  
  10. //Greater number
  11.  
  12. function biggerNumber(input) {
  13.     let a = input[0];
  14.     let b = input[1];
  15.  
  16.     if (a > b) {
  17.         console.log(a);
  18.     } else {
  19.         console.log(b);
  20.     }
  21. }
  22.  
  23.  
  24. //Even or odd
  25.  
  26. function oddOrEven(input) {
  27.     let a = Number(input[0]);
  28.  
  29.     if (a % 2 === 0) {
  30.         console.log('even');
  31.     } else {
  32.         console.log('odd')
  33.     }
  34. }
  35.  
  36. //Password Guess
  37.  
  38. function password(input) {
  39.     let pass = input[0];
  40.  
  41.     if (pass === "s3cr3t!P@ssw0rd") {
  42.         console.log('Welcome')
  43.     } else {
  44.         console.log('Wrong password!')
  45.     }
  46. }
  47.  
  48. //Number 100 to 200
  49.  
  50. function biggerThan100(input) {
  51.     let num = +input[0];
  52.  
  53.     if (num < 100) {
  54.         console.log('Less than 100')
  55.     } else if (num <= 200) {
  56.         console.log('Between 100 and 200')
  57.     } else {
  58.         console.log('Greater than 200')
  59.     }
  60. }
  61.  
  62. //Speed info
  63.  
  64. function speed(input) {
  65.     let speed = +input[0];
  66.  
  67.     if (speed <= 10) {
  68.         console.log('slow')
  69.     } else if (speed <= 50) {
  70.         console.log('average')
  71.     } else if (speed <= 150) {
  72.         console.log('fast');
  73.     } else if (speed <= 1000) {
  74.         console.log('ultra fast')
  75.     } else { console.log('extremely fast') }
  76. }
  77.  
  78. //Area of figures
  79.  
  80. function figuresArea(input) {
  81.     let type = input[0];
  82.     let face;
  83.  
  84.     if (type === 'square') {
  85.         let x = input[1];
  86.         face = x * x;
  87.     } else if (type === 'rectangle') {
  88.         let x = input[1];
  89.         let y = input[2];
  90.         face = x * y;
  91.     } else if (type === 'circle') {
  92.         let r = input[1];
  93.         face = Math.PI * Math.pow(r, 2);
  94.     } else if (type === 'triangle') {
  95.         let x = input[1];
  96.         let h = input[2];
  97.         face = (x * h) / 2;
  98.     }
  99.  
  100.     console.log(face);
  101. }
Advertisement
Add Comment
Please, Sign In to add comment