JSFiddle - React, Tailwind, and code Playground

by Diana Lemen

JavaScript

function pageCount(n, p) {
    const isLessThanMid = p < n / 2;
    
    let count = 0;
    
    if(isLessThanMid) {
				for(let i = 1; i <= 10; i + 2) {
            count = count + 1;
            console.log(count)
        }
    } else {
/*         for(let i = n; i === p; i - 2) {
            count = count + 1;
        }  */
    }
    
    return count;
}

pageCount(6, 2)