SaveText.Ru

Без имени
  1. function translateCountSystems(from, to, number){
  2.         let outputNum = ""
  3.         if(to == 10){
  4.         let num = 0
  5.     for(let i = String(number).length - 1; i >= 0; i--){
  6.         num += Math.pow(from, i)
  7.       console.log(num)
  8.     }
  9.     outputNum =  num;
  10.   }
  11.   return outputNum;
  12. }
  13.  
  14. //console.log(compare(translateCountSystems(10, 5, 30), 110))   
  15.  
  16. console.log(translateCountSystems(2, 10, 111100110))
  17.  
  18. function compare(first, second, ...other){
  19.         if(first == second) return true
  20.   else return false
  21. }

Share with your friends:

Print