Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var myObj = new Object(),
str = "myString",
rand = Math.random(),
obj = new Object();
myObj.type = "Dot syntax";
myObj["date created"] = "String with space";
myObj[str] = "String value";
myObj[rand] = "Random Number";
myObj[obj] = "Object";
myObj[""] = "Even an empty string";
console.log(myObj);
//表示結果
Object { type: "Dot syntax", date created: "String with space", myString: "String value", 0.806938221617259: "Random Number", [object Object]: "Object", : "Even an empty string" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.