LEVEL 10 LESSON 2. Why my code does not work?
Could anyone provide the answer please, when running the OUTPUT is correct but there is a message saying: We cannot see the code to show Hello World on browser.
INDEX.HTML:
<!doctype html>
<html>
<head>
<title>JS with HTML</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
SCRIPT.JS:
let player = {
name: "default_name",
weapon: "Pistol",
exp: "Pro",
// defining method
setName: function(name) {
this.name = name;
},
getName: function() {
return this.name;
},
showInfo: function() {
console.log(`${this.getName()} uses ${this.weapon} and is ${this.exp} level player in STBattleRoyal`);
}
};
player.setName("John Wick");
player.showInfo();
document.write("<h1>Hello World</h1>");