Im doing an incredibly basic javascript exercise for school practicing for Objects. I thought the normal document.write would work but it doesn't, ive looked many places but a lot of it is just for the console. The error is
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
If anyone can help that would be great, sorry if its really easy
Here is my code
var oPerson = {
firstName: 'John',
lastName: 'Travis',
gender: 'Male',
age: 22,
district: 'Northshore',
hairColor: 'Brown',
hairLength: 'Short',
height: '6\'11"',
weight: '74kg',
martialStatus: 'Engaged'
}
document.write(oPerson);
document.write(oPerson.district);
oPerson.resident = "yes";
document.write(oPerson);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Exercise - Personal Info</title>
<script src="practice9JS.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>