Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created June 27, 2016 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksakae1216/ee14d63521307ac3c53332d519efb704 to your computer and use it in GitHub Desktop.
Save ksakae1216/ee14d63521307ac3c53332d519efb704 to your computer and use it in GitHub Desktop.
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