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
I Can't Let You Go (COMPLETED) by Miss_dreamy_writer
31 parts Complete Mature
#1 - Muslim | 16-11-2024 #1 - Urdu | 11-11-2024 #2 - Desi | 16-11-2024 #3 - Strong Female Lead | 16-11-2024 #4 - Replaced Bride | 30-10-2024 #8 - Love Life | 11-11-2024 #36 - Happily Ever After | 27-10-2024 #14 - Family Issues | 31-03-2025 #75 - Muslim Love Story | 3-10-2024 *** I stormed towards him, anger blurring my sights. The moment I was in front of him, I grabbed hold of his collar with my both hands. As I yell, "Are you cheating on me, Shahzain?" Seems like I took him by surprise, it took him a whole minute to realize what was happening right now. And the moment he did, he loosen my hold on him and pushed me, which had me stumbling back. "Even if I do, it shouldn't matter. I was forced into this marriage, Sobia." He yells back. "I didn't have a choice. But you had. You shouldn't have agreed to this marriage." Only if he knew, all my life it wasn't me who got to select the choice. Neither is this one, the most important one in my life. "I won't tolerate this. Either you leave me or leave her." I stated, anger clouding my senses. He walked towards me and took a hold of my chin in his hand and stated clearly. "And where's the fun in that? You ruined my life. I promised to ruin you till death do us a part." I pushed him hard. I had already suffered much from my so-called family. And I refused to get suffered by my husband. It's all about the limit. The moment I had my limit of misery and pain, I will end all of this. "Are you sure, it's not the other way around?" A humorless chuckle escapes my lips, as my darkest shade of eyes met his grey ones. "Also, just wanted to correct you, my dearest husband. You can't ruin what's already ruined, Shahzain." "And if I find out that you kept meeting her behind my back. I will ruin you and that lover of yours." With that I stormed out of our room, making up my mind.
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.
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~
You may also like
Slide 1 of 8
The (im)Perfect Ending | KNJ 🔞 ✓ cover
OCCULT VISION {COMPLETED} ✔️✔️ cover
I Can't Let You Go (COMPLETED) cover
OLD VERSION ✾Balance✾ (Lloyd Garmadon x Fem!Reader) cover
I Will Be The Strongest!! cover
Transcendence (A Muslim-Christian Story) cover
THE GANGSTER'S CRUSH- FAMILY OVER FREEDOM (SAMPLE) cover
With CEO Vyom (Complete) cover

The (im)Perfect Ending | KNJ 🔞 ✓

19 parts Complete Mature

There are stories written about meeting the right person at the wrong time. In your story, he was the right person who was all wrong for you to claim. He was your best mistake, while you were nothing more but a small chapter in his story. A story with an ending that had been written long before you came into the picture. But then life brings you back together again, allowing your unabashed hope to slither its way back in. The only thing you can do is to wonder-will this be just another interlude in his story, or are you given a second chance to rewrite your whole story, with a new pen to write your own happy ending? - ⤑ Title | The (im)Perfect Ending ⤑ Pairings | Namjoon x female reader ⤑ Genre | Past Lovers!au, Second Chance, Infidelity, Smut, Angst