Puas muaj cov ntsiab lus hauv JavaScript?
Puas muaj cov ntsiab lus hauv JavaScript?

Video: Puas muaj cov ntsiab lus hauv JavaScript?

Video: Puas muaj cov ntsiab lus hauv JavaScript?
Video: " puas muaj nub nyoog muag " { pob tsuas xyooj } = nkauj tshiab = 2020-2021 2024, Kaum ib hlis
Anonim

TL; DR: Nyob ntawd yog NO pointers hauv JavaScript thiab cov ntaub ntawv xa mus ua haujlwm txawv ntawm qhov peb ib txwm pom hauv feem ntau lwm yam lus nrov programming. Hauv JavaScript , nws tsuas yog tsis tuaj yeem muaj kev siv los ntawm ib qho sib txawv mus rau lwm qhov sib txawv. Thiab, tsuas yog qhov tseem ceeb sib xyaw (Object, Array) tuaj yeem raug muab los ntawm kev siv.

Tsis tas li ntawd, tus pointer hauv JavaScript yog dab tsi?

Simulating pointers hauv JavaScript . A taw tes yog qhov hloov pauv tau los ntawm qhov koj tuaj yeem nkag mus (nyeem lossis hloov kho) lwm qhov sib txawv. Piv txwv li, txoj haujlwm A tuaj yeem hu ua haujlwm B thiab dhau nws a taw tes rau ib qho ntawm A's local variables.

Ib tug kuj yuav nug, yog JavaScript txoj haujlwm los ntawm kev siv? Nyob rau variable txoj haujlwm , scalar primitive values (Number, String, Boolean, undefined, null, Symbol) yog muab-los-tus nqi thiab cov nqi sib xyaw yog muab-los- siv . Cov cov ntaub ntawv hauv JavaScript tsuas yog taw tes ntawm qhov muaj nuj nqis thiab TSIS ntawm lwm yam hloov pauv, lossis cov ntaub ntawv.

Hauv qhov no, koj siv cov pointers hauv JavaScript li cas?

Tsis yog, JS tsis muaj taw tes . Cov khoom raug dhau los ntawm kev dhau ib daim qauv ntawm kev siv. Tus programmer tsis tuaj yeem nkag mus rau C-zoo li "tus nqi" sawv cev qhov chaw nyob ntawm ib qho khoom.

Puas muaj cov taw qhia hauv Python?

Cov taw qhia tsis muaj nyob rau hauv Python . Tab sis, peb siv tib tus cwj pwm nrog cov khoom sib hloov. Cov Taw tes peb siv nrog ctypes yog tiag C taw tes.

Pom zoo: