Javascript Tagalog - Break Statement
mmvergara
Posted on August 13, 2022
Ano ngaba ang Break Statement sa Javascript?
Yung break na keyword ginagamit siya sa mga loops,switch para ma skip ang execution... something like that
Sa tingin ko yung best way para ma-understand niyo yung break statement ay to show it to you nalang
Break Statement sa while loop (also works on for loops ofcourse)
Naterminate yung execution kasi na execute yung break sa block ng if condition therefore 1,2,3,4 nalang yung na console.log.
one thing to note that if yung while loop ay nasa loob ng function tapos may "Break" sa loob ng while loop. Yung effect ng Break non ay enclosed lang sa while loop and di pwedeng maapektuhan yung execution ng function
Break on switch statement
Break sa switch statement na kapag na fullfill na yung case e-execute nayung codeblock, in this case it is `console.log('x is 2') then break na in return be break na yung switch statement
More tagalog Javascript Learning Resources:
https://javascript-methods-in-tagalog.vercel.app/
Posted on August 13, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.