JS CODES

 Q.CHECK WEATHER THE PERSON CAN DRIVE OR NOT?

let age = 5;

if(age>18){
    console.log("you can drive");
}

else{
    console.log("you can not drive");
}

Q.IS USERS AGE ;IES BETWEEN 10 TO 20 OR NOT?

if (age >= 10 && age <= 20) {
    console.log("Your age is lies between 10 to 20");
}
else{
    console.log("Your age is not lies between 10 to 20");
}

Q.Demonstrate the use switch statement in js?

let day = 3;

switch (day) {
  case 1:
    console.log("Monday");
    break;
  case 2:
    console.log("Tuesday");
    break;
  case 3:
    console.log("Wednesday");
    break;
  case 4:
    console.log("Thursday");
    break;
  case 5:
    console.log("Friday");
    break;
  case 6:
    console.log("Saturday");
    break;
  case 7:
    console.log("Sunday");
    break;
  default:
    console.log("Invalid day");
}










Comments

Popular posts from this blog

SIGMA WEB DEV JAVASCRIPT CLASS NOTES:

WEB DEV CODE NOTES :