JavaScript Program on Conditional Operator

Free Web development courses with real-time projects Start Now!!

Program 1

// n=12
// n%2?console.log("No is Odd"):console.log("No is Even") 

 ///  
 //a,b Grater between two number

 //let a=60,b=20,c
 //a>b?console.log("Grater Number is :" + a):console.log("Grater Number is : " + b)

//    c=a>b?a:b

//    console.log("Grater Number is :" + c)

   // //Grater between four number

    let ch='e'
   ch=='a'||ch=='e'|| ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'|| ch=='I'||ch=='O'||ch=='U'?console.log("Vowel"):console.log("Consonent")

 

Did you like this article? If Yes, please give DataFlair 5 Stars on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *