Problem Statement Given a year (an integer value, as input), determine whether it is a leap year or not

If it is a leap year, return the Boolean value True, otherwise, return False.
For a year to be Leap Year either of the following conditions should be true:
It is divisible by 400.
It is divisible by 4 but it is not divisible by 100.

If none of the above conditions is true, then it is not a leap year.

Input

The first line contains the year to be checked.

Constraints:
1900 ≤ year ≤10^5

Output

The function must return a Boolean value (True/False).

function checkYear( year) {
      
        if (year % 400 == 0)
            return true;
  
        if (year % 100 == 0)
            return false;
  
        
        if (year % 4 == 0)
            return true;
        return false;
    }
  
    
       
        let year = 1900;
        document.write(checkYear(1900) ? "True" : "False" );

I have error for this code
/box/script.js:20
        document.write(checkYear(1900) ? "True" : "False" );
        ^

You can only use document.write if you use document.open before. Maybe you are looking for console.log instead?

Not strictly true - you can document.write() “without opening a document” (see below) - it’ll blow away anything that was in the document (and not in your new document-closure) before you did it though… and the document would need to be loaded before you do so.

Calling write on a closed (loaded) document invokes open automatically. However, use of document.write is strongly discouraged. Either console.log or write the information to an element’s content.

Without knowing what error was output, i’d be guessing at what the problem is; the code as-written works for me just loading it through the console.