Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 13, 2022 05:54 am GMT

Javascript Tagalog - Break Statement


Disclaimer: This is a Blog i made with the intention of reinforcing my knowledge in javascript. I just thought sharing my blogs might be helpful for someone since they are written in tagalog (mostly in informal style). Incase of Misinformation I won't be responsible for it and if you have the time you can comment on the blog to address the mistake. Rest assured I'm always trying my best to be as accurate as possible

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)

Without Break
Javascript Tagalog - Break Statement

With Break
Javascript Tagalog - Break Statement

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

Javascript Tagalog - Break Statement

Break on switch statement
Javascript Tagalog - Break 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

as per usual oversimplified and baka inacurrate information nasulat ko so here's a better in depth documentation (english)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break

More tagalog Javascript Learning Resources:
https://javascript-in-tagalog.netlify.app


Original Link: https://dev.to/mmvergara/javascript-tagalog-break-statement-1ghc

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To