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.
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!
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.
Mystery: Unspoken truth by mishi144
28 parts Complete
Ayeza was a modern girl,a lawyer by profession,all bubbly,full of life without worries.Getting entangled into a mystery of puzzles wasn't on her list.Being at 25 she found herself getting married to a mysterious man whom she never met on her parents wish. while the new life awaits for her she found herself a case of a mysterious murder of a young girl who was found dead in her apartment without a single lead.will she solve the case or will she'll throw herself into an even bigger mess? Do read the story to found out what mysteries awaits for ayeza! .................................... "I'm sorry" he said and I was furious at him now. "You're sorry? You ain't sorry. Nor you ever will be because you don't even know what that even mean." I spat at him controlling myself not to lash at him before I could get my answers from him. "Why did you do that to me? Why you played me?" I asked my voice breaking in middle. "I had my reasons." He replied shortly. "Don't you dare give me that crap. You are going to tell me everything right now or I'm going back to Pakistan and asking for divorce from you" I spat back at him. "Please calm down Ayeza. I'll tell you my every reason. But you need rest right now. We'll talk later" he said trying to touch my hands. "Don't touch me. Don't you dare come close to me even. And start talking if you don't want me to do anything reckless right now" I replied in raging tone. "Fine" he sighed hurt clear on his face ..................................... this is my first story so mistakes are posible please bear with me. Hope you enjoy the story Start: 29 November 2020 Ending: 8 February 2021
You may also like
Slide 1 of 9
I Can't Let You Go (COMPLETED) cover
LOVE BEHIND THE SECRETS ( HIS SERIES BOOK ONE)  cover
Overtook Love|✔️ cover
The Collection Of OS/TS ft.Preeran cover
OCCULT VISION {COMPLETED} ✔️✔️ cover
PRERISH TS: Ishq mein marjawan... cover
Transcendence (A Muslim-Christian Story) cover
Our Royal Love - Part 2 of Royally Yours cover
Mystery: Unspoken truth cover

I Can't Let You Go (COMPLETED)

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.