如何從javascript關聯數組中刪除對象? - How do I remove objects from a javascript associative array?

問題:

Suppose I have this code: 假設我有這個代碼: javascript

var myArray = new Object();
myArray["firstname"] = "Bob";
myArray["lastname"] = "Smith";
myArray["age"] = 25;

Now if I wanted to remove "lastname"?....is there some equivalent of 如今,若是我想刪除「姓氏」?....是否有一些至關於
myArray["lastname"].remove() ? myArray["lastname"].remove() java

(I need the element gone because the number of elements is important and I want to keep things clean.) (我須要元素消失,由於元素的數量很重要,我想保持清潔。) 數組


解決方案:

參考一: https://stackoom.com/question/1S0z/如何從javascript關聯數組中刪除對象
參考二: https://oldbug.net/q/1S0z/How-do-I-remove-objects-from-a-javascript-associative-array
相關文章
相關標籤/搜索