codedamn

Break vs continue vs return

Created by Codedamn about a year ago

0

No description provided

20 Comments

    0

    could you make this tutorial a bit more explained

    @kaarn

    kaarn

    @kaarn

    0

    i dont really get this

    @chineduwali77

    Chinedu Wali

    @chineduwali77

    0

    why i+=2 can you please explain...

    @somnathgolui

    Somnath Golui

    @somnathgolui

    0

    in simple words, if you use continue with condition , the generated result get skipped in output.

    @shivjay

    Digvijay Jere

    @shivjay

    4

    The single equal to (=) sets the value The double equal to (==) checks the value And the triple equal to (===) checks the value as well as the data type.

    @waqui27

    Md. Waqui

    @waqui27

    0

    I couldn't get anything from this video. need to update this video with a better explanation.

    @coderpatel

    Mithlesh Kumar

    @coderpatel

    0

    is too fast.

    @vithyadharan

    Vithyadharan K P

    @vithyadharan

    0

    Dear please start explaining to beginners , your style of explanation not even for Juniors but for Middle programists

    @vitamine007

    Bahodir AHROROV

    @vitamine007

    0

    This is the best JavaScript for beginner course that I have taken. I am learning a lot from this stuff bruv. Thanks a lot Mahul!

    @weirdcodes

    Chidiebere

    @weirdcodes

    2

    Poor Explanation!

    0

    I didn't understand this :(

    @akmalazeem1

    Mohammed Akmal

    @akmalazeem1

    -2

    Very well explained

    @ibrahmounk

    Ibrahima MOUNKORO

    @ibrahmounk

    2

    Confusing Video

    3

    I believe the idea came randomly to him while recording the video, here's the summary of what he exactly wanted to convey: (just copy paste it on to your editor to see the difference & usecase between break and continue):

    //--------------------------------------------------// // break(stops) and continue(skip)

    function skipNumber(number){ let remainingNumbers =[]

    for (let i=0; i<=10 ; i++){
        if (i=== number){
            continue
        }
        remainingNumbers.push(i)
    }
    return remainingNumbers
    

    }

    console.log(skipNumber(6))

    //--------------------------------------------------// /* break: breaks the iteration and continue: skipping in iteration*/

    function breakNumber(number){ let remainingNumbers =[]

    for (let i=0; i<=10 ; i++){
        if (i=== number){
            break
        }
        remainingNumbers.push(i)
    }
    return remainingNumbers
    

    }

    console.log(breakNumber(6))

    @meloneusk

    Melon Eusk

    @meloneusk

    5

    What break does is it exits the loop, nothing below of it will execute , whereas continue just says skip this move on to next, and if you use return in place of break, you not only exit the loop but also the function and function is made to return something, I hope it clears, Keep going Champs!!

    @sarvesh1

    Sarvesh Damle

    @sarvesh1

show more answers
Your comment