SWITCH CASE JAVASCRIPT

Beranda › Forums › Basic Front-End Web Development › SWITCH CASE JAVASCRIPT

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #272324
    akunitbox
    Participant

      var hari = 5;
      switch(hari) {
      case 1:
      console.log(“hari senin”);
      break;

      case 2:
      console.log(“hari selasa”);
      break;

      case 3:
      console.log(“hari rabu”);
      break;

      case 4:
      console.log(“hari kamis”);
      break;

      case 5:
      console.log(“hari jumat”);
      break;

      case 6:
      console.log(“hari sabtu”);
      break;

      case 7:
      console.log(“hari minggu”);
      break;

      default:
      console.log(“Hari tidak valid”);
      }

      Halo izin bertanya apakah sudah benar kode nested if diatas?

      #272536
      Coach Vincent
      Moderator

        untuk koding di atas bukan nested if, tetapi switch case.
        untuk nested if adalah ada conditional dalam conditional

        terima kasih

        • This reply was modified 7 months, 2 weeks ago by Coach Vincent.
      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.
      Shopping cart0
      There are no products in the cart!
      Continue shopping