1. 程式人生 > >JS判斷0或者undefined,將他們全部排除在外

JS判斷0或者undefined,將他們全部排除在外

參考文章:
https://blog.csdn.net/evilcry2012/article/details/52937247

如果0是字串,強轉下即可

the_task_id = result.async_task_id;
if(the_task_id==="0"){
	the_task_id = int(the_task_id)
}
if(the_task_id){
	some codes
}

這樣把0或者undefined全部排除在外了。
Job Done!