Heim >Web-Frontend >js-Tutorial >Konvertierung zwischen JavaScript-Objekten und Strings
JavaScript 对象定义方式
1. var obj = new Object()
[html]
<script> </p> <p>var obj = new Object(); </p> <p>obj.key = "11"; </p> <p>alert(obj.key); </p> <p></script>
2. var obj = {};
[html]
<script> </p> <p>var obj = {}; </p> <p>obj.key = "11"; </p> <p>alert(obj.key); </p> <p></script>