问题遇到的现象和发生背景
无法运行
问题相关代码,请勿粘贴截图
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
var Student={
name:"xiaoming",
age:18,
chinese_score:150,
math_score:150,
avg.function(){
return (this.chinese_score+this.math_score)/2;
}
}
console.log(Student.name);
console.log(Student.avg());
</script>
</body>
运行结果及报错内容
Uncaught SyntaxError: Unexpected token '.'
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
我的解答思路和尝试过的方法
我想要达到的结果
正常运行