問題:
I have a string as我有一個字符串
string = "firstName:name1, lastName:last1";
now I need one object obj such that現在我需要一個對象 obj 這樣
obj = {firstName:name1, lastName:last1}
How can I do this in JS?我怎樣才能在 JS 中做到這一點?
解決方案:
參考一: https://stackoom.com/question/4Yce參考二: String to object in JS