JavaScript to php Error [object HTMLParagraphElement]

That doesn’t make sense in regard to what you were being asked.

When JavaScript has an unknown variable, it will look for an HTML element with a matching id.

<div id="brazil"></div>

It is a better practice these days to explicitly retrieve the element instead:

var brazil = document.querySelector("#brazil");
brazil.innerHTML = +position.coords.latitude;
1 Like