Dab tsi yog array ntawm cov khoom hauv JavaScript?
Dab tsi yog array ntawm cov khoom hauv JavaScript?

Video: Dab tsi yog array ntawm cov khoom hauv JavaScript?

Video: Dab tsi yog array ntawm cov khoom hauv JavaScript?
Video: Data Science with Python! Analyzing File Types from Avro to Stata 2024, Kaum ib hlis
Anonim

JavaScript - Cov Arrays Object . Cov Array khoom cia koj khaws ntau qhov tseem ceeb hauv ib qho kev sib txawv. Nws khaws cia ib qho kev sib sau ua ke ntawm cov khoom ntawm tib hom. Ib array yog siv los khaws cov ntaub ntawv khaws tseg, tab sis feem ntau nws muaj txiaj ntsig zoo los xav txog ib qho array raws li ib tug sau los ntawm variables ntawm tib hom.

Ib yam li ntawd, koj puas tuaj yeem muaj array ntawm cov khoom hauv JavaScript?

Array Cov ntsiab lus Ua tau Ua Yam khoom JavaScript sib txawv ua tau ua khoom . Arrays yog hom tshwj xeeb ntawm khoom . Vim li no, koj tuaj yeem muaj variables ntawm ntau hom nyob rau hauv tib yam Array.

Ib tug kuj yuav nug, qhov txawv ntawm array thiab khoom hauv JavaScript yog dab tsi? Ob leeg khoom thiab arrays raug suav hais tias yog "tshwj xeeb" hauv JavaScript . Yam khoom sawv cev rau hom ntaub ntawv tshwj xeeb uas hloov pauv tau thiab tuaj yeem siv los khaws cov ntaub ntawv sau tseg (tsis yog tus nqi nkaus xwb). Arrays yog ib hom tshwj xeeb ntawm qhov sib txawv uas kuj hloov tau thiab tuaj yeem siv los khaws cov npe ntawm cov txiaj ntsig.

Hauv qhov no, dab tsi yog qhov khoom array?

Ib array ntawm cov khoom , tag nrho cov ntsiab lus ntawm tib chav kawm, tuaj yeem tshaj tawm raws li ib qho array ntawm ib hom built-in. Txhua yam ntawm cov array yog ib khoom ntawm chav kawm ntawd. Muaj peev xwm tshaj tawm arrays ntawm cov khoom nyob rau hauv txoj kev no underscores qhov tseeb hais tias ib chav kawm zoo ib yam li ib hom.

Koj pom li cas yog tias ib qho khoom yog ib qho array hauv JavaScript?

Hauv JavaScript , peb ua tau kuaj yog tias ib variable yog ib array los ntawm kev siv 3 txoj hauv kev, siv txoj kev isArray, siv qhov piv txwv ntawm tus neeg teb xov tooj thiab siv kev tshuaj xyuas hom constructor yog nws phim ib Array khoom . Cov Array . isArray() txoj kev kuaj xyuas seb qhov hloov pauv dhau los yog ib qho Array khoom.

Pom zoo: