DEV Community

BekmuhammadDev
BekmuhammadDev

Posted on • Edited on

Javascript:

Mavzu

  • Loops
  • for loop
  • while
  • do while
  • Functions (Declaration)

SCOPES:
Scopelar 4ta turga bolinadi bular :
1-Global scope
2-Local scope
3-Function scope
4-Block scope
Scope lar quydagicha korinadi :

Image description

Global scope โ€” Hamma kodlar yoziladigan joy

Local scope โ€” Functioni orab turgan joy

Function scope โ€” Function ichida joylashgan qismi

Bloce scops โ€” Biron bir shat yozilsa , Masalan: if elese yokiy for

LOOPS:

JavaScript da asosan ishlatiladigan 3ta loop operatorlari mavjud ular .
1-while
2-do while
3-for operatorlari:

While takrorlanuvchi aperator:while ishlashi

Image description
cansole

Image description

Do while while bilan bir hil ishlaydi farqi shartni oxirida tekshiradi: Do whilening ishlashi

Image description

cansole

Image description

FOR For loop boshqa looplarga qaraganda tez ishlaydi universl loop hisoblanadi va ko'p ishlatiladi:
Forning ishlashi:

Image description

cansole

Image description

FUNCTION DECLERATION
Fuction declaration => bu fuction asosi pilus fuction yaratib uni hohlagan joyda chaqirsak boladi .

Image description
cansole

Image description

Top comments (0)