具有唯一ID的Html标记可以直接用作名为id的变量吗?
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="text" id="mytest">
</body>
<script>
console.log(mytest);
console.log(mytest === document.getElementById('mytest'));
console.log(Object.hasOwnProperty(window,'mytest'));
</script>
</html>
怎么会这样? mytest
在哪里?