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 ja.javascript.info — if (ゼロの文字列)

  • チュートリアル
  • JavaScript 言語
  • JavaScript の基礎
  • 条件分岐: if, '?'
レッスンに戻る

if (ゼロの文字列)

重要性: 5

alert は表示されるでしょうか?

if ("0") {
  alert( 'Hello' );
}

はい、表示されます。

空文字を除く文字列("0" は空ではありません)は論理コンテキストでは true になります。

実行して確認することができます:

if ("0") {
  alert( 'Hello' );
}
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.