Liliana797979

loading bar - fundamentals

Jun 11th, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function loadinBar(n) {
  2.     let str = '';
  3.     let newN =( n / 10);
  4.     for (i = 0; i < 10; i++){
  5.         if (i < newN) {
  6.             str += '%';
  7.         } else {
  8.             str+='.'
  9.         }
  10.     }
  11.     if (n != 100) {
  12.         console.log(`${n}% [${str}]`);
  13.         console.log(`Still loading...`);
  14.     } else {
  15.         console.log(`${n}% Complete!`);
  16.         console.log(`[${str}]`);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment