JavaScript中的“新”运算符是什么?
JavaScript中的new关键字是new运算符。它创建用户定义的对象类型的实例。
语法
这是语法-
new constructor[([arguments])]
示例
让我们看一个例子来学习new操作符的用法-
<!DOCTYPE html>
<html>
<body>
<p id="test"> </p>
<script>
var dept = newObject();
dept.employee = "David";
dept.department = "Programming";
dept.technology = "C++";
document.getElementById("test").innerHTML =
dept.employee + "is working on " + dept.technology + " technology.";
</script>
</body>
</html>热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短