???? js? ???? ??????? ?? ???? ??(?? ??)? js? ???? ??????? ?? ??? ? ?? ??? ???? ?? ??????. ??? ?? ?????.
TypeError:?Cannot?read?property?'xxx'?of?undefined TypeError:?Cannot?read?property?'xxx'?of?null TypeError:?xxx.map?is?not?a?function
??? ?? ??? ???? ???, ??? ???? ?????? ???? ?? ? ????. ??? ??? ??? ???? ?? ???? ?????. ??? ??? ??? ??? ??? ??? ???? ????? ???? ?????
//?第一種做法肯定是這樣的 if(a){ ??return?a.name?||?'你沒名字' } //?這種做法處理簡單的還能湊合用,但是如果你遇到這樣的呢?user.country.area.city.name,難道要這樣寫 if(user?&&?user.country?&&?user.country.area?&&?user.country.area.city){ ??return?user.country.area.city.name?||?'你沒名字' } //?這是多么痛苦的一件事情?@后端兄弟 //?第二種,感謝es6 let?{country={area:{city:{name:'你沒名字'}}}}?=?user; 這個感覺也不是很好的解決方案 //?第三種,利用reduce構(gòu)建一個解析函數(shù) function?getValue(obj,key){ ??return?key.split('.').reduce(function(o,k){ ????//?o,當前對象 ????//?key,數(shù)組下一個元素 ????if((typeof?o?===?'undefined'?||?o?===?null)){ ??????return?k.indexOf('[array]')?!==?-1?[]:o ????}else{ ??????return?k.indexOf('[array]')?!==?-1?(o[k.replace('[array]','')]||[]):o[k] ????} ??},obj) } let?user1; let?user2?=?{ ? } let?user3?=?{ ?country:{ ??area:{ ???city:{ ????name:'12312' ???} ??} ?} } let?user4?=?{ ?country:[ ??{ ???city:{ ????name:'12312' ???} ??} ?] } let?user5?=?{ ?country:{ ??city:[1,2,3] ?} } console.log(getValue(user1,'country.area.city.name')) console.log(getValue(user2,'country.area.city.name')) console.log(getValue(user3,'country.area.city.name')) console.log(getValue(user5,'country.city[array]')) console.log(getValue(user5,'country.city[array].1')) console.log(getValue(user5,'country.city[array].10')) console.log(getValue(user5,'country.city[array].1.name')) console.log(getValue(user5,'country.city[array].persion[array]')) //?輸出結(jié)果 undefined undefined "12312" [1,?2,?3] 2 undefined undefined []
? ??? ??? ??? ? ??? ??????? ?????. ? ???? ??? ??? PHP ??? ????? ?? ?? ??? ?????!
?? ??:
webpack.config.js ???? ?? ????
? ??? js? ???? ??????? ?? ???? ??(?? ??)? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP? JS? ???? ?? ?? ??? ??? ?? ?? ?? ??? ?? ???? ?? ???? ?? ?? ????? ??, ??, ??? ?? ???? ??? ???? ??? ?? ????? ??? ? ??? ?????. ??? ?? ??. ? ????? ?? ?? ??? ?? PHP ? JS? ???? ?? ?? ??? ??? ??? ?????. 1. ?? ???? ?? ?? ??? ???? ???. 1. PHP? ???? ?? 2. HTML5 ? Canvas? ???? ???? 3

?? ?? ? ?? ??? ?? ????? ???? ?? ???? ?????. ?? ?? ?? ???? ??? ?? ??? JS???. ? ??????? ?? ?? ? ??? ???? ?? ??? ?? ??? ?? ??? ??? ????. ???? ???? ?? ?? ? ??? ??? ?? ??? ?? ??? ?? ???? ??? ??? ????? ??? ????. ?? ??? ?? ???? ???? ?????. js? ???? ??? ?? ??? ???? ??? ?????? ??? ?? ??? ????? JavaScript, HTML, CSS, WebRTC ? ?? ????? ?? ? ??? ???? ???. ??? ?? ??? ?? ? ???? ??? ????? ???. ? ??? ????? ?? ??? ??? ????.

?? ??? ?? ?? ??: PHP ? JS?? ?? ??? ??? ??? ?????. ???? ??? ??? ???? ?? ??? ?? ????? ??? ?? ? ??? ?????. ????? ???? ????? ?? ??? ???? ????? ??? ??? ?? ?????. PHP? JS? ???? ?? ??? ??? ??? ??? ???? ? ?? ??? ??? ? ??? ?? ?? ???? ??? ?? ? ????. ???? ??? ??? ???? ??? ???? ?? ?????. ??? ?????

JS ? Baidu Map? ???? ?? ? ??? ???? ?? Baidu Map? ?? ??, ?? ?? ? ?? ??? ???? ?? ? ??? ?? ???? ?? ???? ?? ??? ??????. ? ???? JS? Baidu Map API? ???? ?? ?? ??? ???? ??? ???? ???? ?? ??? ?????. 1. ?? ??? ? API? ???? ?? ?? ??? ? ?? ???(http://lbsyun.baidu.com/)?? ??? ??? ???? ??????? ???? ???. ?? ??

JS ? Baidu Maps? ???? ?? ? ?? ??? ???? ?? ??: ???? ??? ??? ??? ???? ??? ???? ?? ????? ?????. ??? ?? ??? ???? ??? ??? ?? ????? ???? ? ??? ? ? ????. ? ????? JS ? Baidu Map API? ???? ?? ??? ??? ???? ??? ???? ???? ?? ??? ?????. ?? ??: ???? ?? Baidu ??? ??, ?????? ??, ?? AP ?? ?? ??? ???? ???.

JS ? Baidu Maps? ???? ?? ?? ??? ?? ??? ???? ?? ??: ? ????? ??? ?? ? ??? ??? ???? ?? ?? ??? ???? ?? ??? ????. ????? ?? ??? ??? ?? ???? ????? ???? ??? ?????. ? ???? JS? Baidu Map API? ???? ??? ?? ??? ?? ??? ???? ??? ???? ???? ?? ??? ?????. ??: Baidu Map API ?? ???? ?? ?? ??? ?? Baidu Map API ??? ??? ? ????.

??? ??? ??? ???? ?? ?? ??? ?? ? ?? ???? ??? ?????. ?? ???? ?? ??? ??? ?? ??? ???? ???? ?? ??? ??? ??? ? ??? ?? ????? ???? ??? ?? ?????. ? ????? PHP? JS? ?? ??? ???? ??? ?? ?? ??? ??? ??? ????? ???? ???? ?? ??? ?????. 1. ?? ?? ??? ?? ?? ?? ??? ??? ??? ???? ?? ?? ?? ??? ?????? ???? ???. ???? ??? ???? ??????.

js? vue? ??: 1. ? ??? ??? JS 2. ????? ???????? Vue.js? ?? 3. JS? Vue? ?? ???? ?? 4. JS? Vue? ?? ?? Vue.
