ArfIsAToe

Supposed to be only js but i'm learning css too xd

Jun 20th, 2021 (edited)
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.15 KB | None | 0 0
  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>oy mate</title>
  8.     <style>
  9.         body{
  10.             background-color: lavender;
  11.         }
  12.         div
  13.         {
  14.             color: lightblue;
  15.             font-family: fantasy;
  16.             text-align: right;
  17.             font-size: 3em;
  18.             text-shadow: 2px 2px lightslategray  ;
  19.             animation: meMove 5s linear infinite alternate ;
  20.             white-space: nowrap;
  21.         }
  22.         @keyframes meMove
  23.         {
  24.             from {margin-right: 100%;}
  25.             50%  {margin-right: 0%;}
  26.             to   {margin-right: 100%;}
  27.         }
  28.         a{
  29.             text-decoration: none;
  30.             color: mediumaquamarine;
  31.             text-shadow: -1px 1px gray;
  32.         }
  33.     </style>
  34. </head>
  35. <body>
  36.     <div id="Initial">Initial Array</div>
  37.     <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ"><p id="initialArray">    </p></a>
  38.     <div id="SemiFinal">Array after generating passwords</div>
  39.     <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ"><p id="iterative"> </p></a>
  40.     <div id="Final">Array after generating passwords recursively</div>
  41.     <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ"><p id="recursively"> </p></a>
  42.     <script>
  43.         var users=[
  44.             {
  45.                 name:"Nabil", password:""
  46.             },
  47.             {
  48.                 name:"Amal", password:""
  49.             },
  50.             {
  51.                 name:"Melek", password:""
  52.             },
  53.             {
  54.                 name:"Walid", password:""
  55.             },
  56.             {
  57.                 name:"Farah", password:""
  58.             },
  59.             {
  60.                 name:"Ibrahim", password:""
  61.             },
  62.             {
  63.                 name:"Chedi", password:""
  64.             },
  65.             {
  66.                 name:"Rostom", password:""
  67.             },
  68.             {
  69.                 name:"Rostom", password:""
  70.             }
  71.         ];
  72.        
  73.         document.getElementById("initialArray").innerHTML = JSON.stringify(users, null, 2);
  74.         // this is the only line in code that I Don't udnerstand ^
  75.        
  76.         for ( var a=0; a<users.length;a++)
  77.        {
  78.            console.log(users[a]);
  79.        }      
  80.  
  81.        console.log("_____________We Did It Boys, Password Error Is No More___________________")
  82.  
  83.  
  84.        function generateRandomPassword(length)
  85.        {
  86.            var pass="";
  87.            var stringOfChars ="azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN";
  88.            for (var a =0; a<length;a++)
  89.            {
  90.                pass += stringOfChars.charAt(Math.floor(Math.random()* stringOfChars.length));
  91.            }
  92.            //console.log(pass);
  93.            //console.log(length);
  94.            return pass;
  95.        }
  96.        for (var a=0; a<users.length;a++)
  97.        {
  98.            let randomLength= Math.floor(Math.random()*6 +10) ;
  99.            users[a].password=generateRandomPassword(randomLength);
  100.            console.log(users[a],"password length= "+randomLength);
  101.        }
  102.        
  103.        document.getElementById("iterative").innerHTML = JSON.stringify(users, null, 2);
  104.        // this is the only line in code that I Don't udnerstand ^
  105.        
  106.        console.log("____________We Did It Boys, Password Error Is No More V2__________________")
  107.        function recursivePasswordGenerator (users,size)
  108.        {
  109.            var passwordLength= Math.floor(Math.random()*6 +10);
  110.            users[size].password=generateRandomPassword(passwordLength);
  111.            console.log(users[size],"PassLength= "+passwordLength);
  112.            if (size ==0)
  113.            {
  114.                return;
  115.            }
  116.            else {
  117.                recursivePasswordGenerator(users,size-1);
  118.            }
  119.        }
  120.        recursivePasswordGenerator(users,users.length-1)      
  121.        document.getElementById("recursively").innerHTML = JSON.stringify(users, null, 2);
  122.        // this is the only line in code that I Don't udnerstand ^
  123.  
  124.    </script>
  125. </body>
  126. </html>
Add Comment
Please, Sign In to add comment