Javascript Tagalog - Arrow Function

mmvergara

mmvergara

Posted on August 5, 2022

Javascript Tagalog - Arrow Function

Ano ngaba ang Arrow Function sa Javascript?

Yung arrow function is parang minified version lang kung pano tayo mag define ng function. tignan monalang tong mga pics matamad ako eh.

Standard Arrow Function

Standard Arrow Function

eto yung standard structure ng arrow function, atleast in my interpretation. Parameters naka wrap sila sa parenthesis with the trademark "=>" of the arrow function and the wrap sa {} yung code block.

pwede mo modify yung arrow function in some cases para mas masimplify


1 Expression only

 Expression only javascript tagalog

Pwede monang alisin yung curly braces and return statement if 1 expression lang gagamitin mo para mag return ng value

if may kailangan munang may i execute na ibang code before returning maglagay ka dapat ng {} paramaging accessible yung ';' syntax. Don't forget the 'return' also


1 Parameter only
 Parameters only Tagalog

Pwede monang alisin yung parenthesis para sa parameters if 1 lang yung parameter mo


Callback Function

Very useful sila sa mga Callback function for example.

 Callback function tagalog javascript


"This" Keyword in arrow function

arrow function is this keyword javascript tagalog

hindi nako pupunta sa details and go in-depth pwede ka pumunta sa mdn docs for that. Pero for best practices wag gagamitin ang ARROW FUNCTION sa pag define ng method kasi nag bebehave differently ang 'This' keyword sa arrow function in this case nag popoint ang this keyword ng getAge sa window/Global object actually.


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

💖 💪 🙅 🚩
mmvergara
mmvergara

Posted on August 5, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Javascript Tagalog - Arrow Function
javascript Javascript Tagalog - Arrow Function

August 5, 2022