平成30/ 2018-10-24 06:43
JavaScript object


    #### Example

var obj = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

alert(obj.firstName);




################
var obj = {a:100, b:80};

obj.c = 92;
obj["d"] = 76;




################
function searchUrl(obj){
    $.each(obj,function(k,v){
        if(v==''){ return true; }
        alert(k+':'+v);
    });
}
----
// object なら、関数の引数で利用できるので便利っす
var obj={
area   :$('#search_area').val(),
type_id:$('#search_type_id').val(),
word   :$('#search_word').val()
};
searchUrl(obj);



    #### Thanks.

JavaScript Objects
https://www.w3schools.com/js/js_object_definition.asp

プロパティの追加と削除
http://www.ajaxtower.jp/js/object/index5.html

JSのObjectをforEachで処理する方法
http://qiita.com/nantekkotai/items/6c603b40ac2264e9f6f6