vscode 编写js 写html时报错,提示第一行<!doctype html> 错误,错误提示 invalid syntax

如图,在使用vscode 编写javascript写html时报错,提示第一行 错误,错误提示 invalid syntax
不知道怎么解决,求解

img

文字格式写错了,应该是大写的UTF-8👀

script的type不要有空格

这个提示有可能是用了中文的标点符号,装没装html的扩展,没有的话装一个

script写在body里面


<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>
</head>
<body>
   
</body>
</html>

标准的 格式