Dab tsi yog txhais los ntawm tus nqi tseem ceeb hauv JavaScript?
Dab tsi yog txhais los ntawm tus nqi tseem ceeb hauv JavaScript?

Video: Dab tsi yog txhais los ntawm tus nqi tseem ceeb hauv JavaScript?

Video: Dab tsi yog txhais los ntawm tus nqi tseem ceeb hauv JavaScript?
Video: Kauj vab kauj le _(1 tsug 13 hnub part #9)_ Phees lauj Ft Maiv xis fullmusic Mv 2023 2024, Hlis ntuj nqeg
Anonim

Hauv JavaScript , a keeb kwm ( tus nqi qub , keeb kwm hom ntaub ntawv) yog cov ntaub ntawv uas tsis yog khoom thiab tsis muaj txoj hauv kev. Muaj 7 keeb kwm cov ntaub ntawv hom: hlua, naj npawb, bigint, boolean, null, undefined, thiab cim.

Xav txog qhov no, txhais tau li cas los ntawm qhov tseem ceeb tshaj plaws?

Ib ' keeb kwm ' cov ntaub ntawv hom txhais tau tias tias koj muaj a tus nqi khaws cia hauv nco--qhov no tus nqi tsis muaj txoj hauv kev lossis cov qauv sab hauv. A keeb kwm tuaj yeem ua haujlwm tsuas yog los ntawm kev ua haujlwm sab nraud. Hauv Java, primitives yog cov lej ( int , long, etc.) thiab char.

Tom qab ntawd, lo lus nug yog, dab tsi yog qhov tseem ceeb thiab siv cov ntaub ntawv hauv JavaScript? Hauv JavaScript , a sib txawv tuaj yeem khaws ob hom ntawm cov ntaub ntawv : primitive thiab siv . JavaScript muab rau hom thawj zaug as undefined, null, boolean, number,string, and symbol, and a hom siv khoom. Hauv luv luv, a sib txawv uas khaws cov khoom yog nkag los ntawm siv.

Ib sab saum toj no, dab tsi yog qhov qub thiab tsis yog hauv JavaScript?

Cov ntaub ntawv hom uas hu ua keeb kwm tus nqi hauv JavaScript yog lej, hlua, booleans, null, undefined. Cov khoom xws li kev ua haujlwm thiab arrays raug xa mus rau tsis yog - keeb kwm tus nqi. Qhov sib txawv nruab nrab ntawm primitives thiab tsis - keeb kwm yog tias keeb kwm yog immutable thiab tsis yog - keeb kwm yog mutable.

Dab tsi yog tus nqi tsis tau txhais hauv JavaScript?

Ntawm qhov tod tes, tsis tau txhais txhais tau hais tias qhov sib txawv tsis tau tshaj tawm, lossis tsis tau muab a tus nqi . Thaum koj tshaj tawm qhov hloov pauv hauv javascript , nws yog muab rau tus nqi undefined . Qhov no txhais tau tias qhov sib txawv yog untouched thiab tuaj yeem muab rau ib qho twg tus nqi yav tom ntej.

Pom zoo: