Chào ac e mới đang mò mẫm về javascript và html nhưng e đang vướng 1 chỗ này mong mng giải đáp
Em có đoạn code như này
Đây là html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<title>Check spy</title>
</head>
<body>
<h1>Welcome to Part 9: Your JavaScript Level One Project!</h1>
<p>For this project you will be building a generic website that will seem to ask mundane
questions to normal users, but you secretly are looking for a spy! Anyone visiting your website will be asked a series of questions,
only the Spy will be able to give specific answers you expect. If all question are answered correctly, you will posta secret message in console for the Spy to read!</p>
<script src="checking_spy.js" ></script>
</body>
</html>
Còn đây là javascravascript ạ
alert("Hello! I will ask you some question?");
var firstName = prompt("What is your First Name?");
var lastName = prompt("What is your Last Name?");
var age = prompt("How old are you?");
var tall = prompt("How tall are you in centimeters");
var petName = prompt("What is your pet name?");
if(firstName[0] == lastName[0] && (20 <= age && age <=30) && petName[petName.length-1] == "y"){
console.log("Welcome Comrade! You've passed the Spy Test");
}
else{
console.log("Sorry, nothing to see here.");
}
nhưng khi e chạy nó thì nó chạy javascript luôn chứ k load html trước ạ
Ac có kinh nghiệm chỉ e với ạ