Forem

PUSHAN VERMA
PUSHAN VERMA

Posted on

3 2

if-else ,ternary Operator,switch statements in JavaScript

if-else

let age=16;

if(age===16)
{
console.log("your age is 16");
}
else if(age<16)
{
console.log("age is less than 16");
}
else if(age ==20)
{
console.log("you are no longer a teen ager");
}
else
{
console.log("age is more than 16");
}

Image description

Ternary Operator
console.log((age==16?"my age is 16":"my age is not 16"));

Image description

switch
switch(age)
{
case 16:
{
console.log("you are 16");
break;
}
case 18:
{
console.log("you are 18");
break;
}
case 20:
{
console.log("you are 20");
break;
}
default:
{
console.log("you are not 16,18,20 , bhad mei jao");
break;
}
}
Image description

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

đź‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay