TypeError: document.getElementsById is not a function [closed]

Here is my code :

function Nhap(first,last,age,year){
    this.FirstName=first;
    this.LastName=last;
    this.personAge=age;
    this.personYear=year;

    this.fullinfo=function() {
        return this.FirstName +" "+ this.LastName
    };
}
    const myBrother = new Nhap("Minh","Do",15,2010);
    document.getElementsById("p1").innerHTML= myBrother.fullinfo();

i try to change and see some example in w3 but it not stop give me error