Tech Junkie Blog - Real World Tutorials, Happy Coding!: JavaScript : The ? Ternary Operator

Friday, November 12, 2021

JavaScript : The ? Ternary Operator

The conditional ?: operator in JavaScript has three operands the first part goes before ? the second goes between the ? and the : symbol and the third operand goes after the : symbol.  You can think of this operator as shorthand way of writing a an if statement.  The first operand evaluates to a boolean, if the first operand is true then evaluate the second operand else evaluate the third operand.

Let's say we want to want to see what the gender of the baby is and assign it a name, let's demonstrate it with code.

var gender = "girl";

var name = gender === "boy" ? "Julian" : "Julie";

console.log(name);

The code above assigns the variable gender to "girl" then it uses the conditional ?: to assign a value to the variable name if the gender is "boy" then assign the name "Julian" to name, else assign the name "Julie"



Type the code into the browser console you will get "Julie" as name

















6 comments:




  1. Hello all
    am looking few years that some guys comes into the market
    they called themselves hacker, carder or spammer they rip the
    peoples with different ways and it’s a badly impact to real hacker
    now situation is that peoples doesn’t believe that real hackers and carder scammer exists.
    Anyone want to make deal with me any type am available

    Available Services

    ..Wire Bank Transfer all over the world

    ..Western Union Transfer all over the world

    ..Credit Cards (USA, UK, AUS, CAN, NZ)

    ..School Grade upgrade / remove Records

    ..Spamming Tool

    ..keyloggers / rats

    ..Social Media recovery

    .. Teaching Hacking / spamming / carding (1/2 hours course)

    discount for re-seller

    Contact: 24/7

    fixitrogers@gmail.com




    ReplyDelete
  2. Cyberz Phoenix is a Group of Multinational Hackers & Spammers. We make sure by all means necessary that our clients get the best of services on A PAYMENT.
    Rather than send money and trust a criminal to fulfill your deal. You'll get excellent customer service.
    That's a 100% guarantee.

    BEWARE OF FRAUDSTARS
    if you have been a VICTIM,
    Contact:
    Telegram : @Cyberz_Phoenix
    ICQ : @1001829652
    WICKR : @cyberzphoenix for directives.
    Here, it's always a win for you.
    Without any Reasonable doubts, it is no news that Cyberz Phoennix offer one of the best services.

    Amongst others, services we offer are listed as follows :

    Fresh and valid USA SSN leads :
    >> SSN+DOB
    >> SSN+DOB+DL
    >> Premium high score fullz (also included relative info)

    TUTORIALS AVAILABLE FOR
    SPAMMING
    CARDING
    CASHOUTS
    MOBILE DEPOSITS
    >APPLE PAY & ANDROID TAP CASH
    >BANK TRANSFER
    >HOW TO CASHOUT DUMPS+PINS
    >MOBILE DEPOSIT

    >SAFE SOCKS5 (USA)
    >SMTP Linux Root
    -->DUMPS+PINS
    (How to use & create dumps with pins track 1 & 2)

    >SERVER I.P's & proxies in bulk
    >USA EMAILS Combo
    >Fresh Leads for tax returns & w-2 form filling
    >CC's with CVV's (vbv & non-vbv)
    >USA Photo ID'S (Front & back)
    >Payment mode BTC, ETH, LTC, & USDT

    Contact:
    Telegram : @Cyberz_Phoenix
    ICQ : @1001829652
    WICKR : @cyberzphoenix

    ReplyDelete
  3. There aren’t enough words to describe or explain my wonderful experience with CYBERCREDITGURU a US based Russian h a c k e r s. In 2018, I had 205 BTC in my blockchain wallet but out of my carelessness I misplaced my password and recovery phrase. I really don’t know how to go about it until early this year, I came across a 5star review about them in a forum online by one Mrs. Kimberly and I reached out to them via text: +1 (650) 439 0624 and CYBERCREDITGURU (AT) GMAIL DOT COM. They responded immediately and helped recovered my lost BTC wallet within 4 days. Thanks to Team CyberGuru. I also had an extremely poor credit report of 403 with derogatory; late payment, repossession, collections and foreclosure. They also cleared all negative items from my credit report and upgraded my FICO score to 810 across all three major bureaus. Now with no doubts I can say 2022 is a great year for me as I am a proud owner of a new house and a car. All thanks to CYBERCREDITGURU once again. They are my messiah! I confidently recommend them to you.

    ReplyDelete
  4. Update October 23, 2023 - TELE @jackhieu - SELL FULLZ/DEADFULLZ/DUMPS

    ReplyDelete
  5. This article presents a clear and concise explanation of the JavaScript ternary operator, offering practical examples that demystify this powerful shorthand for conditional logic. Its straightforward style makes even complex programming concepts accessible and engaging. Similarly, students aiming for clarity and precision in their academic writing may find that professional thesis writing help UK offers the structured support they need to elevate their work with precision and polish.

    ReplyDelete
  6. Money Transfers

    bank login

    bank transfer

    writing cheques

    transfer to cc ...

    track 1 and 2 with pin

    Sell Fresh CVV - Western Union Transfer - Bank Login - Card Dumps - Paypal - Ship

    Fresh Cards, Selling Dumps, Cvvs, Fullz

    Tickets,Hotels,Credit card topup...Paypal transfer, Mailer,Smtp,western union login,

    Book Flight Online SSN infos with DL photos in bulk UK NIN data with sort codes Canada SIN data

    SELL CVV GOOD And HACK BIG CVV GOOD Credit Card

    Fresh Cards. Selling Dumps, Cvvs, Fullz.Tickets,Hotels,Credit cards


    Sell Cvv(cc) - Wu Transfer - Card Dumps - Bank login/paypal

    And many more other hacking services

    contact me : Wuhacker@yahoo.com
    Telegram: Vcare524
    Discord: Vcare089

    - I have account paypal with good balance

    - I hope u good customers and will be long-term cooperation


    Prices Western Union Online Transfer


    -Transfer(Eu,Uk,Asia,Canada,Us,France,Germany,Italy and very

    easy to do African)

    - 200$ = 1500$ (MTCN and sender name + country sender)

    - 350$ = 4000$ (MTCN and sender name + country sender)

    - 500$ = 6000$ (MTCN and sender name + country sender)

    - 600$ = 8000$ (MTCN and sender name + country sender)

    Then i will do transfer's for you, After about 30 mins you'll have

    MTCN and sender name + country sender


    - Dumps prices

    - Tracks 1&2 US = 85$ per 1

    - Tracks 1&2 UK = 100$ per 1

    - Tracks 1&2 CA / AU = 110$ per 1

    - Tracks 1&2 EU = 120$ per 1


    Bank Logins Prices US UK CA AU EU


    - Bank Us : ( HALIFAX,BOA,CHASE,Wells Fargo...)

    . Balance 5000$ = 250$

    . Balance 8000$ = 400$

    . Balance 12000$ = 600$

    . Balance 15000$ = 800$

    . Balance 20000$ = 1000$

    - Bank UK : ( LLOYDS TSB,BARCLAYS,Standard Chartered,HSBC...)

    . Balance 5000 GBP = 300 GBP

    . Balance 12000 GBP = 600 GBP

    . Balance 16000 GBP = 700 GBP

    . Balance 20000 GBP = 1000 GBP

    . Balance 30000 GBP = 1200 GBP


    contact me : Wuhacker@yahoo.com
    Telegram: Vcare524
    Discord: Vcare089

    ReplyDelete

Search This Blog