Koj tuaj yeem qhia tau li cas yog tias ob yam khoom zoo sib xws?
Koj tuaj yeem qhia tau li cas yog tias ob yam khoom zoo sib xws?

Video: Koj tuaj yeem qhia tau li cas yog tias ob yam khoom zoo sib xws?

Video: Koj tuaj yeem qhia tau li cas yog tias ob yam khoom zoo sib xws?
Video: Koj Tsuas Zoo Tham Xwb Tsis Zoo Yuav - Maiv Xis Hawj (Official MV 2023) 2024, Hlis ntuj nqeg
Anonim

Yog ob yam khoom muaj tib lub cev, lawv hu ua " zoo sib xws ." Thaum ob cov duab yog zoo sib xws , qhov sib piv ntawm qhov ntev ntawm lawv qhov sib thooj yog sib npaug. Rau txiav txim yog tias daim duab peb sab qhia yog zoo sib xws , sib piv lawv cov sib raug zoo sab.

Tsis tas li ntawd, ua li cas koj thiaj paub tias ob yam khoom sib npaug?

Yog tus ob yam khoom muaj qhov tseem ceeb, sib npaug () yuav rov qab muaj tseeb. Hauv qhov sib piv thib ob, sib npaug () xyuas kom pom seb cov dhau lawm khoom yog null, or yog nws tau ntaus raws li lwm chav kawm. Yog nws yog lwm chav kawm ces tus khoom tsis yog sib npaug . Thaum kawg, sib npaug () muab piv rau khoom ' teb.

thaum siv nrog cov khoom Dab tsi yog qhov sib npaug == tus neeg teb xov tooj sib piv tiag tiag? Cov vaj huam sib luag (==) yog siv rau piv ob qhov txiaj ntsig lossis kev nthuav qhia. Nws yog siv rau piv tus lej, cov hlua, Boolean qhov tseem ceeb, hloov pauv, khoom , arrays, lossis functions. Qhov tshwm sim yog TRUE yog tias cov kab lus yog sib npaug thiab FALSE txwv tsis pub.

Ua li no, koj piv cov khoom li cas?

== sib piv khoom cov ntaub ntawv siv, nws tshawb xyuas seb puas yog ob lub operands taw tes rau tib yam khoom (tsis sib npaug khoom , tib khoom ). Yog koj xav tau piv cov hlua (kom pom tias lawv muaj tib cov cim), koj yuav tsum tau piv cov hlua siv sib npaug.

Peb puas tuaj yeem sib piv cov khoom hauv JavaScript?

Muab piv cov khoom yog ib qho yooj yim, siv === los yog Yam khoom .is(). Cov haujlwm no rov qab muaj tseeb yog tias lawv muaj qhov siv tib yam thiab tsis tseeb yog tias lawv ua tsis yog. Ib zaug ntxiv, cia kuv ntxhov siab, nws yog sib piv cov ntaub ntawv rau cov khoom , tsis yog tus nqi ntawm cov khoom . Yog li, los ntawm Piv txwv 3, Yam khoom .is(obj1, obj2); yuav rov cuav.

Pom zoo: