GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing uz.javascript.info — Massiv kontekstida chaqirish

  • Qo'llanma
  • JavaScript dasturlash tili
  • Ma'lumot turlari
  • Massivlar
darsga qaytish

Massiv kontekstida chaqirish

Natija qanday? Nima uchun?

let arr = ["a", "b"];

arr.push(function () {
  alert(this);
});

arr[2](); // ?

arr[2]() chaqiruvi sintaktik ravishda eski obj[method](), bizda obj – arr rolida va 2– method rolida.

Shunday qilib, biz obyekt usuli sifatida arr[2] funktsiyasini chaqiramiz. Tabiiyki, u arr obyektiga murojaat qilib this ni oladi va massivni chiqaradi:

let arr = ["a", "b"];

arr.push(function () {
  alert(this);
});

arr[2](); // a,b,function(){...}

Massivda 3 ta qiymat mavjud: dastlab unda ikkita qiymat mavjud edi, funktsiya qiymati qo’shildi.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.