Advertisement
DawidG

JAVASCRIPT - TABLICE

Jan 16th, 2022
1,077
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Zadania JS</title>
  8. </head>
  9. <body>
  10.     <!--
  11.     <h1>Zadanie 1</h1>
  12.     <script>
  13.         var koledzy = ["Damian", "Rafał", "Eustachy"];
  14.         var twoi_koledzy = koledzy.push("Adam", "Wiktor");
  15.         console.log(koledzy);
  16.         var twoi_koledzy = koledzy.pop();
  17.         console.log(twoi_koledzy);
  18.     </script>
  19.     <hr>
  20.  
  21.     <h1>Zadanie 2</h1>
  22.     <p>podpunkt a</p>
  23.     <script>
  24.  
  25.         var tab1 = [7, 3, 1, 6, 9, 5, 4, 10, 2, 2];
  26.         var sliczba = tab1[tab1.length -6];
  27.         console.log(sliczba);
  28.          tab1.splice(7,1, "12");
  29.         console.log(tab1);
  30.        
  31.     </script>
  32.  
  33. <p>podpunkt b</p>
  34.  
  35.     <script>
  36.  
  37.         var tab2 = [2, 6, 3, 9, 4, 1, 7, 8, 5, 12];
  38.         console.log(tab2);
  39.         tab2 = tab1;
  40.         console.log(tab2);
  41.  
  42.     </script>
  43.  
  44. <p>podpunkt c</p>
  45.  
  46.     <script>
  47.         var tab3 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  48.         console.log(tab3);
  49.     </script>
  50.  
  51.     <hr>
  52.     <h1>Zadanie 3</h1>
  53.     <script>
  54.         tablic = [a, b, c, d, e];
  55.         var a = parseInt(prompt("Wprowadz liczbę"));
  56.         var b = parseInt(prompt("Wprowadz liczbę"));
  57.         var c = parseInt(prompt("Wprowadz liczbę"));
  58.         var d = parseInt(prompt("Wprowadz liczbę"));
  59.         var e = parseInt(prompt("Wprowadz liczbę"));
  60.         var dodaj = tablic.push(a, b, c, d, e);
  61.         console.log(tablic);
  62. /*
  63.         math.max.apply(null, tablic);
  64.         math.min.apply(null, tablic);
  65.         console.log(tablic);
  66. */      
  67.  
  68.         console.log("Posortowana" + tablic.sort());
  69.     </script>
  70.     <hr>
  71. -->
  72.     <h1>Zadanie 4</h1>
  73.     <script>
  74.         var tablica = [];
  75.         var tablica = new Array(100);
  76.         console.log(tablica);
  77.         tablica = Math.pow(100, 2);
  78.         console.log(tablica);
  79.     </script>
  80. </body>
  81. </html>
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement