[javaScript] What does ‘=>’ in javaScript?

최대 1 분 소요

What is ‘=>’?

You might be wondering when you see => in JS code. It is an arrow function.

If you learned Python, then It is easy to think like Python’s lambda function.

How to use it?

I will change a traditional function to arrow function for example.

function test(a, b) {
	return a + b;
}

you should remove ‘function’, name of function, and ‘()’ like this:

let test = (a, b) => a + b;

The End

댓글남기기