Ad
Code
Diff
  • const cinema_auditorium = (spisok2D, ryad) => {
      let soldTickets = 0;
    
      if (spisok2D && ryad >= 0 && ryad < spisok2D.length) {
        for (let seat of spisok2D[ryad]) {
          if (seat === 1) {
            soldTickets++;
          }
        }
      }
      return soldTickets;
    }
    • const cinema_auditorium = (spisok2D,ryad)=> {
    • console.log(spisok2D,ryad)
    • return 3
    • const cinema_auditorium = (spisok2D, ryad) => {
    • let soldTickets = 0;
    • if (spisok2D && ryad >= 0 && ryad < spisok2D.length) {
    • for (let seat of spisok2D[ryad]) {
    • if (seat === 1) {
    • soldTickets++;
    • }
    • }
    • }
    • return soldTickets;
    • }
Code
Diff
  • const tab = (f, a, b, h) => {
      let sum = 0;
      for (let x = a; x <= b; x += h) {
        sum += f(x);
      }
      return sum;
    };
    
    
    • const tab = (f, a, b, h) => {
    • }
    • let sum = 0;
    • for (let x = a; x <= b; x += h) {
    • sum += f(x);
    • }
    • return sum;
    • };
Code
Diff
  • function sumNechet(a, b) {
      let sum = 0;
    
      function нечетное(число) {
        return число % 2 !== 0;
      }
    
      for (let i = a; i <= b; i++) {
        if (нечетное(i)) {
          sum += i;
        }
      }
    
      return sum;
    }
    
    console.log(sumNechet(0, 5)); 
    
    • function sumNechet(a, b) {
    • let sum = 0;
    • function нечетное(число) {
    • return число % 2 !== 0;
    • }
    • for (let i = a; i <= b; i++) {
    • if (нечетное(i)) {
    • sum += i;
    • }
    • }
    • return sum;
    • }
    • function нечетное(число) {
    • }
    • console.log(sumNechet(0, 5));