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 fa.javascript.info — if (رشته‌ای شامل عدد صفر)

  • آموزش
  • زبان جاوااسکریپت
  • مفاهیم پایه‌ای جاوااسکریپت
  • انشعاب شرطی: 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.