Advertisement
vladovip

Print DNA

Feb 7th, 2021
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dnaPrint(number) {
  2.  
  3.     let str = "ATCGTTAGGG";
  4.  
  5.     let counter = 0;
  6.  
  7.     for (let i = 0; i < number; i++) {
  8.  
  9.       if (i % 4 == 0) {
  10.  
  11.         console.log(`**${str[counter % 10]}${str[(counter % 10) + 1]}**`);
  12.  
  13.       } else if (i % 4 == 1) {
  14.  
  15.         console.log(`*${str[counter % 10]}--${str[(counter % 10) + 1]}*`);
  16.  
  17.       } else if (i % 4 == 2) {
  18.  
  19.         console.log(`${str[counter % 10]}----${str[(counter % 10) + 1]}`);
  20.  
  21.       } else if (i % 4 == 3) {
  22.  
  23.         console.log(`*${str[counter % 10]}--${str[(counter % 10) + 1]}*`);
  24.  
  25.       }
  26.  
  27.       counter += 2;
  28.  
  29.     }
  30.  
  31.   }
  32.   dnaPrint(4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement