js給json對象添加、刪除、修改屬性

<script type="text/javascript"> //json對象 var json={ "firstName":"Bill" , "lastName":"Gates"}; //給json對象添加新的屬性並賦值 json.sex="man"; //也能夠以下添加新的屬性並賦值 json["sex"]="man"; //刪除json對象的firstName屬性 delete json.
相關文章
相關標籤/搜索