console.log(user[username],user[password]) 同時(shí)輸出 這兩個(gè) 為什么一個(gè)是 123456,一個(gè)是undefined
? ? ???console.log(user[username],user[password])? ? 同時(shí)輸出? 這兩個(gè)? ?為什么一個(gè)是? 123456,一個(gè)是undefined
? ? ???console.log(user[username],user[password])? ? 同時(shí)輸出? 這兩個(gè)? ?為什么一個(gè)是? 123456,一個(gè)是undefined
2020-01-06
舉報(bào)
2020-01-09
要看你的這個(gè)user的格式是什么,
如果是{admin:123456}這樣
那么user[username]其實(shí)是指user.admin? 。? 所以是123456
user[password]其實(shí)是user.12346,? 由于沒有123456這個(gè)key ,所以是undefined