JavaScript 判断 Undefined 类型

 1 var cookiestr = '';
 2     chrome.cookies.getAll(
 3         {
 4             'url': 'https://mp.weixin.qq.com',
 5             'secure': true
 6         }, function (cookies) {
 7             for (var i in cookies) {
 8                 if (typeof (i.name) != 'undefined' && typeof (i.value) != 'undefined') {
 9                     cookiestr += i.name + '=' + i.value + ';';
10                 }
11             }
12             alert(cookiestr);
13 
14     });

 

posted on 2016-10-09 09:27  東風missile  阅读(167)  评论(0编辑  收藏  举报

导航