Story cover for Control Flow in JavaScript by mahesh1439
Control Flow in JavaScript
  • WpView
    Reads 1
  • WpVote
    Votes 0
  • WpPart
    Parts 1
  • WpHistory
    Time <5 mins
  • WpView
    Reads 1
  • WpVote
    Votes 0
  • WpPart
    Parts 1
  • WpHistory
    Time <5 mins
Ongoing, First published May 03, 2024
Control flow in JavaScript is a fundamental concept that dictates the order in which statements are executed within a script. It enables developers to control the flow of program execution based on conditions and loops. Understanding control flow is essential for writing efficient and logic-driven JavaScript code.

Conditional Statements

Conditional statements allow developers to execute code based on specific conditions. JavaScript provides several types of conditional statements:

if statement: This statement evaluates a condition and executes a block of code if the condition is true. For example:

if (condition) {
    // Code block to execute if condition is true
}

if...else statement: It executes one block of code if a condition is true and another block if the condition is false. Example:

if (condition) {
    // Code block to execute if condition is true
} else {
    // Code block to execute if condition is false
}

else if statement: This statement allows for multiple conditions to be checked sequentially. Example:

if (condition1) {
    // Code block to execute if condition1 is true
} else if (condition2) {
    // Code block to execute if condition2 is true
} else {
    // Code block to execute if neither condition1 nor condition2 is true
}
switch statement: It evaluates an expression and executes code based on a matching case label. Example:

switch (expression) {
    case value1:
        // Code block to execute if expression equals value1
        break;
    case value2:
        // Code block to execute if expression equals value2
        break;
    default:
        // Code block to execute if expression doesn't match any case
}

Loops

Loops are used to execute a block of code repeatedly until a specified condition is met. JavaScript supports different types of loops:

for loop: Executes a block of code a specified number of times. Example:

for (initialization; condition; iteration) {
    // Code block to execute
All Rights Reserved
Sign up to add Control Flow in JavaScript to your library and receive updates
or
Content Guidelines
You may also like
Transcendence (A Muslim-Christian Story) by BintUmmi
41 parts Complete
"So you approached me without being aware of my identity?" He asks me, while raising an eyebrow. To say I was shocked would be an understatement. It takes me a while to compose myself and form a sensible reply. "Yes, I wasn't aware of your identity." "You might think you can fool me, but trust me, this has happened quite a few times before as well." He says with a very serious expression. I'm baffled by his accusation. This man has the audacity to question my intentions when he's the one trying to converse with me all along. I don't know what comes over me, but whenever I'm overwhelmed with anger, it turns into tears. And before I can compose myself, I taste the salty tears in my mouth. I take a few deep breaths, place the cup on the side table and get up to leave. "Thank you for your hospitality and your excellent assessment of my character. I will now take your leave." With that, I turn to head towards the door but he grabs my hand and pulls me towards him. Characters: Ameerah is a happy-go-lucky 23 year old who has recently graduated from med school. She is an optimist with quite a rosy view of the world. She is far from perfect. She has her faults; some she's aware of and others, not so much. She's stronger than most in some ways, weaker than many in others. Sebastian McArdle is a Consultant in General Surgery at the Royal London Hospital. He's one of the youngest and most accomplished surgeon in town. To an outsider, his life would seem perfect. He's young, handsome, successful, rich and hails from one of the most respected families in the country. But life is not always what it seems to be. He has his own set of problems. As Our Holy Qur'an states Surah An-Nisa, Verse 28: Allah desires that He should make light your burdens, and man is created weak. Follow a story of trials and errors, to finding her path to love, and to Life.
Vowels Of Raghuvanshi's by meowislazy
35 parts Ongoing
"Viki, please, don't do this to me. You're hurting me" "Adu, please, trust me, I would never do that" _____________________________________ "Agastya, please save my baby, you know how much I love her. I beg you, I won't do any mischief, I will do everything you say, but please save our kid" "Ayesh, book!!! Ayesh, calm down. What are you doing? I will save our baby." _____________________________________ "Ahaan, I've given 3 chances still you want me to be a sensible person. I never wanted to take her away from you. I wanted her to experience love" "Please, Isha! I know I made a big mistake. I was crying everyday. Regretting everytime I've done to you" _____________________________________ "Ayaan, please. I love you!! Don't leave me. I know I made mistakes in the past but I want to forget everything and start a new life with you" "Urina, I'm giving you 2 days, do whatever you want but make me impressed by you. I've always loved you but something was stopping me, but now nothing's gonna separate us" _____________________________________ Hey everyone, okay so let me start by introducing myself:- • I am Ashka • I am a student • I just thought of taking my feelings out because there was no one to listen there's two person who can do that but I just have some trust issues so I just thought of representing my thoughts as a story to some people. Okay? So now 8 hearts, 4 couples, 2 family, 4 brothers, 4 sisters. Let's see how these 8 hearts are gonna get back on their track. Lights, camera and action📷.
THE GANGSTER'S CRUSH- FAMILY OVER FREEDOM (SAMPLE) by qudseesheikh
11 parts Complete Mature
"Cupcake, if you don't agree to marry me, no one can help you from getting killed. You, your parents, and your friend they'll be dead the moment I step out, not because I want to kill you or them but because everyone who goes against my word must die, that's the rule. Marrying me will just keep you safe. Don't worry I am not a monster and yes, after today no one would dare think about marrying you" "What??" Rida thought the quota of her misery would be over, now that Drake was gone but the miseries were not done dealing with her. Zeus smirks looking at her, was this his plan all along? Rida followed him as he walked out of the venue. "Say your goodbyes we are leaving" Zeus states staring back at Rida who had no idea what just happened. "But- I- " "We don't have time" Zeus reminds her. "But-" "your parents will die Rida!" Rida agreed to marry the monster because of her parents, to keep them safe, and even now she has no choice but to leave with a stranger to assure their safety. "Can't you help-" Zeus stares at her, why would he help someone who means nothing to him, maybe he could have but why would he want to do that without a reason? "..." Which is a better option? Marrying a rapist or his boss? Rida was left with worse choices, but her parents' lives depended on her decision. Why? Who? When? Didn't matter when lives were at stake. Rida chooses to go with Zeus when promised to keep her parents alive and safe. She traded her life and freedom for their lives, it's a pretty deal? Isn't it? Will it really be? The Gangster's Crush is a story- about love, trust, loyalty, and revenge It is available on Amazon, please support me. Disclaimer: Adult scenes, 16+ I hope you like the story if you do please share it with your friends. Word count 20,000 - 23,000~
PRERISH TS: Ishq mein marjawan... by kavyanjali08
5 parts Complete Mature
"Iss ishq mein marjawan Kuch bhi kasam se karjawan Hadh se bhi guzarjawan Kuch bhi kasam se karjawan " He puts forward the proposal of marriage to give his daughter a mother, She accepts the proposal as a deal to save the man she loves, The equation of their marriage is simple in which love wasn't even a factor between them and they were fine with their marriage being of convenience. But suddenly their simple equation changes into complicated one when unbeknownst he starting to having feelings for her. While a incident changes her perspective too making her realize that everything isn't same as before... The man she loved has changed so much that she doesn't recognize him while her husband isn't as she thought him to be. Learning the hard way she starts to try and understand the enigma that her husband is... finding herself getting enamored by him... He decides to win his love and for that he is ready to anything because his love has no limits for her. Ready to extract his revenge by finding a way around his promise because it has become more personal than ever, if such a thing was even possible... While she decides that no matter what the circumstance have been, it was time to let go off the chains of past because they have no place in her present or future. Hard and painful might it be but she was ready to find new roads in her life... Lastly, he is ready to do anything to have her back by his side and for that he has to rescue her from the clutches of the Devil which is easier said than done but now he was ready risk whatever it takes to win... To save the love of his life and his family... Three lives are going to change with their decisions, game of love is being played to win hearts, along with mind games to leave the heads reeling... Who is going to win this love-game? And who is going to get trapped in the maze of mind-games? Stakes are high and even higher risks are taken to win in this race... let the chase begin!
You may also like
Slide 1 of 9
LOVE BEHIND THE SECRETS ( HIS SERIES BOOK ONE)  cover
Transcendence (A Muslim-Christian Story) cover
Vowels Of Raghuvanshi's cover
The (im)Perfect Ending | KNJ 🔞 ✓ cover
ONE STEP(Dark Indian Romance)😏 cover
Tangled ✓ cover
THE GANGSTER'S CRUSH- FAMILY OVER FREEDOM (SAMPLE) cover
PRERISH TS: Ishq mein marjawan... cover
OLD VERSION ✾Balance✾ (Lloyd Garmadon x Fem!Reader) cover

LOVE BEHIND THE SECRETS ( HIS SERIES BOOK ONE)

24 parts Ongoing

𝘿𝙚𝙨𝙞 𝙍𝙤𝙢𝙖𝙣𝙘𝙚 𝙇𝙤𝙫𝙚 𝙎𝙩𝙤𝙧𝙮 •| Two persons who never ever fell in love with someone and have their own circumstances, challenges against their lives, what will happen when they meet each through their parents and how will their life take a trun? *Romance and Emotion* Forbidden love Secret affair Love triangle Heartbreak Betrayal Passion Obsession Jealousy *Mystery and Suspense* Hidden truth Secrets and lies Mysterious past Conspiracy Revenge plot Twisted fate Dark secrets Shocking revelation *Drama and Conflict* Family feud Love vs. loyalty Revenge and retaliation Secrets and deception Tangled web Complicated relationships Emotional turmoil Tragic consequences *Genre-Specific* Romance Drama Thriller Mystery Suspense 6. Young Adult (YA) 7. New Adult (NA) 8. Contemporary You can also consider long-tail keywords, which are more specific phrases with lower competition. For example: - "Forbidden love stories with a revenge twist" - "Secrets and lies in romance novels" - "Love triangle stories with a mysterious past"