script.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. function classWork1 (){
  2. let ask = prompt("take a numb").match(/\d+/);
  3. for (let i=1; i<=ask ; i++){
  4. console.log(`numb:${i}`)
  5. }
  6. }
  7. function classWork2 (){
  8. const days = {
  9. 1:'monday',
  10. 2:'tuesday',
  11. 3:'wednesday',
  12. 4:'thursday',
  13. 5:'friday',
  14. 6:'saturday',
  15. 7:'sunday',
  16. 8:'monday',
  17. 9:'tuesday',
  18. 10:'wednesday',
  19. 11:'thursday',
  20. 12:'friday',
  21. 13:'saturday',
  22. 14:'sunday',
  23. 15:'monday',
  24. 16:'tuesday',
  25. 17:'wednesday'
  26. }
  27. let rec={};
  28. for (let day in days){
  29. let wDay = days[day];
  30. if (wDay in rec){
  31. rec[wDay]++
  32. }else{
  33. rec[wDay]=1
  34. }
  35. }
  36. for (let week in rec){
  37. console.log(`${week}: ${rec[week]}`)
  38. }
  39. }
  40. function classWork3 (){
  41. let binar = new Array();
  42. let num
  43. do{
  44. num = prompt("введите 0/1");
  45. binar.push(num)
  46. }while(num != null)
  47. var otv = binar.join("");
  48. var assk = parseInt(otv, 2);
  49. alert(assk)
  50. console.log(assk);
  51. }
  52. function homeWork(){
  53. var str = '';
  54. var numb = prompt("numb");
  55. var diez = numb
  56. var minus = 0
  57. for (var i = 0; i < numb; i++) {
  58. let m = "-".repeat(diez-- -1)
  59. let d = "#".repeat(minus++ + minus)
  60. str = m + d + m
  61. console.log(str)
  62. }
  63. }