{"size": 971, "ext": "js", "max_stars_repo_path": "09. JS Fundamentals - Sep 2018/02. Operations And Logic Flow/8_Figure_of_4_Squares.js", "max_stars_repo_name": "zrusev/SoftwareUniversity2016", "max_stars_repo_stars_event_min_datetime": "2019-11-15T18:22:47.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-15T19:02:05.000Z", "max_issues_repo_path": "09. JS Fundamentals - Sep 2018/02. Operations And Logic Flow/8_Figure_of_4_Squares.js", "max_issues_repo_name": "zrusev/SoftUni_2016", "max_issues_repo_issues_event_min_datetime": "2019-12-27T19:53:50.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T12:27:02.000Z", "max_forks_repo_path": "09. JS Fundamentals - Sep 2018/02. Operations And Logic Flow/8_Figure_of_4_Squares.js", "max_forks_repo_name": "zrusev/SoftUni_2016", "max_forks_repo_forks_event_min_datetime": "2019-09-21T15:02:11.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-15T18:22:52.000Z"}
{"max_stars_count": 2, "max_issues_count": 23, "max_forks_count": 2, "avg_line_length": 19.8163265306, "max_line_length": 56, "alphanum_fraction": 0.4232749743}
function figureOf4Squares (n) {
  let container = [];
  let rows = 0;

  if(+n %2 === 0) {
    rows = n - 1;
  } else {
    rows = n;
  }

  for(let row = 1; row <= rows; row++) {
    let middleRow = Math.floor(rows / 2) + 1;

    if(row === 1 || row === middleRow || row === rows) {
      container.push(`+`);

      for(let col = 1; col < 2 * +n - 2; col++) {
        let middleCol = Math.floor((2 * +n - 1) / 2);
  
        if(col === middleCol) {
          container.push(`+`);        
        } else {
          container.push(`-`);
        }
      }

      container.push(`+\n`);
    } else {
      container.push(`|`);

      for(let col = 1; col < 2 * +n - 2; col++) {
        let middleCol = Math.floor((2 * +n - 1) / 2);
  
        if(col === middleCol) {
          container.push(`|`);        
        } else {
          container.push(` `);
        }
      }

      container.push(`|\n`);
    }

  }

  console.log(container.join(''));
}

figureOf4Squares(5);