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 uk.javascript.info — if (рядок з нулем)

  • Підручник
  • Мова програмування JavaScript
  • Основи JavaScript
  • Умовні розгалуження: if, '?'
назад до уроку

if (рядок з нулем)

важливість: 5

Чи буде показано alert?

if ("0") {
  alert( 'Привіт' );
}

Так, буде.

Будь-який рядок, окрім порожнього (і "0" не є порожнім), перетворюються на true у логічному контексті.

Ми можемо запустити та перевірити:

if ("0") {
  alert( 'Привіт' );
}
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.