Cov khoom ua haujlwm li cas hauv JavaScript?
Cov khoom ua haujlwm li cas hauv JavaScript?

Video: Cov khoom ua haujlwm li cas hauv JavaScript?

Video: Cov khoom ua haujlwm li cas hauv JavaScript?
Video: Kuv Hlub Koj - Escapes | Video Lyrics 2024, Kaum ib hlis
Anonim

Ua haujlwm nrog khoom . JavaScript yog tsim los ntawm qhov yooj yim khoom -raws li paradigm. Ib khoom yog ib qho kev sau ntawm cov khoom, thiab cov cuab yeej yog kev koom tes ntawm lub npe (los yog qhov tseem ceeb) thiab tus nqi. Cov khoom muaj nqis ua tau ua ib txoj haujlwm, nyob rau hauv cov ntaub ntawv cov cuab yeej yog hu ua ib txoj kev.

Ua kom pom qhov no, cov khoom siv dab tsi hauv JavaScript?

Yam khoom Methods Methods yog cov yeeb yam uas tuaj yeem ua tau khoom . Yam khoom cov khoom tuaj yeem yog ob qho tib si tseem ceeb, lwm yam khoom , thiab functions. Ib khoom method yog ib khoom cov cuab yeej uas muaj lub luag haujlwm txhais. JavaScript objects yog cov thawv rau npe muaj nuj nqis, hu ua cov khoom thiab cov txheej txheem.

Tsis tas li ntawd, koj yuav pib qhov khoom hauv JavaScript li cas? Yam khoom tuaj yeem yog pib siv tshiab Yam khoom (), Yam khoom . tsim(), lossis siv cov ntawv sau (initializer notation). Ib khoom initializer yog ib qho comma-delimited daim ntawv teev npe ntawm xoom lossis ntau dua khub ntawm cov npe khoom thiab cov txiaj ntsig cuam tshuam ntawm ib qho khoom , nyob rau hauv curly braces ({}).

Ntxiv mus, dab tsi yog qhov khoom hauv JavaScript nrog piv txwv?

Ib qho khoom siv javaScript yog qhov chaw muaj lub xeev thiab tus cwj pwm ( khoom thiab txoj kev). Piv txwv li: tsheb, cwj mem, tsheb kauj vab, lub rooj zaum, iav, keyboard, saib thiab lwm yam JavaScript yog ib hom lus siv. Txhua yam yog ib yam khoom hauv JavaScript.

Koj txhais li cas ib yam khoom hauv JavaScript?

Loosely hais lus, cov khoom hauv JavaScript tej zaum txhais raws li kev sau tsis raug ntawm cov ntaub ntawv muaj feem cuam tshuam, ntawm hom qub lossis siv siv, hauv daim ntawv ntawm "qhov tseem ceeb: tus nqi" khub. Cov yuam sij no tuaj yeem hloov pauv lossis ua haujlwm thiab hu ua cov khoom thiab cov txheej txheem, feem, hauv cov ntsiab lus ntawm ib qho khoom.

Pom zoo: